Display GuiHealthBarHud when controlled by Advanced Camera
by Eustacia Green · 08/12/2004 (10:31 am) · 1 comments
First you will need to implement the excellent advanced camera resource. I also recommend adding the AdvancedCam Orbitmode.
In game/advancedCamera.cc add:
I just put it at the end of the file.
In game/advancedCamera.h
and finally
In game/fps/guiHealthBarHud.cc
I'm not sure if I need this but I added it for good measure after #include "game/shapeBase.h":
In game/advancedCamera.cc add:
I just put it at the end of the file.
// eag return player object used in guihealthbar
ShapeBase* AdvancedCamera::getPlayerObject()
{
return mPlayerObject;
}In game/advancedCamera.h
below: F32 &getOrbitChangeAngle(); F32 &getOrbitChangeZoom(); Add: // eag Method to get the player object ShapeBase* getPlayerObject();
and finally
In game/fps/guiHealthBarHud.cc
Change the following lines:
if (!control || !(control->getType() & PlayerObjectType))
return;
to:
if (!control || !(control->getType() & PlayerObjectType))
// return;
// eag
// player is controlled by camera
// get the player from the camera object
{
if (control->getType() & CameraObjectType)
{
control = conn->getCameraObject();
AdvancedCamera* camera = reinterpret_cast<AdvancedCamera*>(control);
control = camera->getPlayerObject();
if (!control)
return;
}
else
{
return;
}
}
// end eagI'm not sure if I need this but I added it for good measure after #include "game/shapeBase.h":
// eag Healthbar with camera controlling player #include "game/advancedCamera.h"
About the author
Recent Blogs
• Theme Editor 1.0• Plan for Eustacia Green
• Plan for Eustacia Green
• Plan for Eustacia Green

Torque Owner Josh Williams
Default Studio Name