Game Development Community

Vehicle cameras

by Richard Jones · in Torque Game Engine · 03/14/2002 (9:07 am) · 9 replies

Hi,

When you control a wheeled vehicle diretly (such as in the Racing demo) the engine uses the "cam" node to determin the camera position in third person mode.
However, if you control a character and mount the vehicle, the engine doesn't use the "cam" node, but it just positions the camera behind the player as it would if you weren't in the vehicle. How can I make it so the engine positions the camera at the "cam" node when mounting a vehicle in 3rd person?

Thanks.

#1
03/14/2002 (9:21 am)
I think there is a

cameraMaxDistance = 10

value somewhere in the wheeled vehicle script which moves the camera backwards farther than is standard. Increase the value to about 20 and it fixes the problem (if you can call it a problem)
#2
03/14/2002 (3:04 pm)
Thanks for your help.
Unfortunately, that value only seems to alter the distance from the car and not the height so it is still difficult to see where you are going.
Maybe its possible to set the position of the camera manually like:

camera.position = vehicle.cam.position

or something?
#3
06/09/2003 (6:05 am)
Hi everybody,

I have some problems with vehicle camera too.

1. When my car is upside down, I can see underground part of my level - I don't like it but I don't know what causes that.
2. In the situation when two vehicles bump each other, cars are shaking (what is not so bad), but camera is shaking too - I would like to avoid such an effect.

Both problems appear in first and third person camera modes.

Do you have any idea?
Best regards

Ania
#4
06/09/2003 (6:07 pm)
@Richard camerOffset is the variable for the height of the camera, it seems to default to 1.5, if you increase it to 3 or 4 you'll have the camera much higher behind the vehicle in third person.

In my game you can't leave the car so that simplifies things a lot, but this line sets the camera:

// Update the camera to start with the car
   %this.camera.setTransform(%player.getEyeTransform());

Changing the variable there might change the camera position as well...
Not sure how to do that, but hope that helps.

Nick
#5
06/09/2003 (7:14 pm)
@ imagination I think your problem is your collision box. Most likely what is happening is that your car sinks into the terrain slightly and thus your camera is also probably underground. Test with making the collision box much higher than the top of your car.
#6
12/19/2004 (7:13 am)
Not to dig up a dead post, but is there any way at all to make the camera use the vehicle's cam nodes when mounted? Velocity lag doesn't work when mounted, and it uses the player eye node rather than the vehicle's. I like velocity lag :). I think its a nice effect and would be great if it still worked.

Any information would be most appreciated it.

Thanks,
-Jase
#7
12/19/2004 (7:47 pm)
This is exactly why I use a cutom 3rd person vehicle camera.
#8
12/23/2004 (12:44 pm)
Make this change to line 1616 of shapeBase.cc to get the 3rd person cam when a player is in a vehicle.

....
if ( *pos != 0 )
{
// begin change ... use 3rd person came of vehicle when mounted
if ( isMounted() )
{
getObjectMount()->getCameraTransform( pos, mat );
return;
}
// end change
#9
12/26/2004 (3:22 am)
Well, I was hoping to not have to break into the source. But your fix worked like a charm!

I appreciate the help, thanks again.

-Jase