(t3d 1.1a) Camera Offset x, y, and z axis?
by Michael A Bocchi · in Torque 3D Professional · 01/06/2010 (8:39 am) · 2 replies
Greetings fellow developers. I am wondering if it is possible to offset the players 3rd person camera in the x,y and z axis? I have pushed the camera back behind the player a little ways, But I would like to have it sit above the player and be tilted downward.
So that it would look like this.
Camera
------\
-------\
--------\
---------\
----------\
-----------\
------------v
-------------Player
Please excuse my awesome artistic styling.
So basically the camera follows the player like normal but is above and looking at a slight downward slope. According to the T3D documentation this should be possible, but I have not been able to figure out how to implement it.
Any help on this matter is greatly appreciated.
So that it would look like this.
Camera
------\
-------\
--------\
---------\
----------\
-----------\
------------v
-------------Player
Please excuse my awesome artistic styling.
So basically the camera follows the player like normal but is above and looking at a slight downward slope. According to the T3D documentation this should be possible, but I have not been able to figure out how to implement it.
Any help on this matter is greatly appreciated.
Torque 3D Owner Rapid Fire
Rapid Fire Studios
Something like :
void Player::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot) { if (!mControlObject.isNull() && mControlObject == getObjectMount()) { mControlObject->getCameraParameters(min,max,off,rot); return; } const Point3F& scale = getScale(); *min = mDataBlock->cameraMinDist * scale.y; *max = mDataBlock->cameraMaxDist * scale.y; off->set(mDataBlock->Offset.X, mDataBlock->Offset.Y, 0.0f); rot->set(EulerF(0.0f,MATH_PI - tan(mDataBlock->Offset.x/mDataBlock->cameraMaxDist ),0.0f)); }It's very quick done-in-my-head modification, but with a little tinkering (and adding an offset camera property to the datablock) you should be able to move the camera around more freely and keep it still focussed on the player. This method will also be modifiable in the editor. For yours you would want a low CameraMaxDist and a high Offset.Y.
If you can't get the exact mechanics you want from Player::GetCameraParameters() then the next step is to start diving into ShapeBase::GetCameraTransform() It's a little more complex but you should definitly be able to get the appropriate mechanic in there.
Edit: Changed the trig code to make a little more sense