Game Development Community

Vehicle and camera angle in 3rd person view?

by houpan · in Torque Game Engine · 05/31/2011 (2:02 am) · 5 replies

I'm playing with the starter.racing example and I'd like to prevent the camera from rotating to follow the angle of the vehicle's x axis when in 3rd person view. The way it is now, if you drive up a steep hill you're suddenly looking at the sky rather than the roof of the vehicle. Ideally I'd like the camera to just point down at the car at a fixed angle. I am guessing this could be done by modifying Vehicle::getCameraTransform in vehicle.cc, probably by changing this bit: (?)



I would like to turn when the car's front wheels can see it is side.

thank you for help me!!!

// Build a transform that points along the eye axis
// but where the Z axis is always up.
if (mDataBlock->cameraRoll)
mat->mul(eye,rot);
else {
MatrixF cam(1);
VectorF x,y,z(0,0,1);
eye.getColumn(1, &y);
mCross(y, z, &x);
x.normalize();
mCross(x, y, &z);
z.normalize();
cam.setColumn(0,x);
cam.setColumn(1,y);
cam.setColumn(2,z);
mat->mul(cam,rot);
}

About the author

Recent Threads


#1
05/31/2011 (2:06 am)
that is fixed Forward . and for example car speed game!
#2
05/31/2011 (2:16 am)
when Accelerated the camera far away from the car
#3
06/02/2011 (11:52 am)
Just wondering, how do you have the C++ code? Your current account doesn't show any licenses.
#4
06/02/2011 (11:22 pm)
thank you very much .I think do this code.can solve the problerm..


y = vp - ep;
fCameraOff = y;//camera offset


fCameraOff.z = 0.f;// mCameraOffset -=
(mCameraOffset * mDataBlock->cameraDecay +
/*mRigid.linVelocity*/fCameraOff * mDataBlock->cameraLag) * dt;
....
thank you!!
#5
06/02/2011 (11:22 pm)
thank you very much .I think do this code.can solve the problerm..


y = vp - ep;
fCameraOff = y;//camera offset


fCameraOff.z = 0.f;// mCameraOffset -=
(mCameraOffset * mDataBlock->cameraDecay +
/*mRigid.linVelocity*/fCameraOff * mDataBlock->cameraLag) * dt;
....
thank you!!
#6
06/02/2011 (11:22 pm)
thank you very much .I think do this code.can solve the problerm..


y = vp - ep;
fCameraOff = y;//camera offset


fCameraOff.z = 0.f;// mCameraOffset -=
(mCameraOffset * mDataBlock->cameraDecay +
/*mRigid.linVelocity*/fCameraOff * mDataBlock->cameraLag) * dt;
....
thank you!!
#7
06/03/2011 (7:24 am)
Yeah, kinda interesting, has access to the forum, but no Product owned?