Game Development Community

restricting angles of movement

by Sebastiao P. de Almeida · in Torque Game Engine · 01/13/2003 (8:57 am) · 2 replies

I'm working on a game with flying vehicles and I would like to restrict the roll angle, as well as the "cone" in which the player moves (you know, to keep him facing a certain direction). There is some easy way to do it?

Thanx for your time

#1
01/18/2003 (8:38 am)
There are two ways you can approach this, one is to simply set hard limits in the code on the roll and yaw angles, the other would be to generate forces to counter the rotation of the vehicle. An example of the force generation is the "Gyroscope" in the flyingVehicle.cc code, around line 446. You could do the same, except of doing a dot product with (0,0,1), you could use (0,1,0) for straight along the Y axis, etc. You'd have to play with the forces involved until it feels good.

Putting the hard clamp on the orientation would probably take place in the Vehicle::updatePos method, though that approach probably won't work well if the vehicle is still allowed to collide with objects.
#2
01/18/2003 (8:51 am)
Looks like the clamping approach was addressed in another
post.
Thanks guys :)