Game Development Community

TGEA and cars

by Tom · in Torque Game Engine Advanced · 07/29/2008 (7:33 pm) · 3 replies

Alright so i guess its better to see for your self

go to your projects -> templates folder, run it, add a car in the world creator and enter

now drive!

u will find that once u stop moving the mouse for turning the wheels return to normal, making it difficult to turn... unless you drop the camera at the player first, then the mouse controls work fine


my question is, how can i make it so that it works correctly right from the start

it seems to be related to with gamepad support

any ideas??? i could hack it by making the camera drop automatically when you mount the car, but that seems hacky

what does everyone think about this wierd behaviour?

#1
07/30/2008 (7:26 am)
I've seen the same issue.

I investigated it a bit this morning and it seems that something changed with vehicles and control objects.

If you look in PLAYERDATA::onCollision() you'll see the following:
// Only mount drivers for now.
         %node = 0;
         %col.mountObject(%obj,%node);
         %obj.mVehicle = %col;
         %obj.client.setcontrolobject(%col);
... which looks correct to me... the vehicle should be the new control object, but that causes what seems like camera jitters and steering shakes. I *suspect* that something changed with the Player class and control objects when mounted.

If you comment out the setcontrolobject() line in the code above the vehicle seems to work correctly... albeit that i don't know exactly why that is.
#2
07/30/2008 (7:42 am)
I tried debugging this once and found that %obj.client.setcontrolobject(%col); will set the server object right but not the client.

I changed it to %obj.setcontrolobject(%col); and that seemed to fix it.

I never tried to comment it out.
#3
07/30/2008 (8:08 am)
Alright thanks::)


the one thing i noticed with the wheel jitter
seems to be exactly what u need if you are using a gamepad, where the range of the joystick is reflected, because if you keep moving the mouse back then the wheels stay. on a gamepad if you move the stick left, its being constantly being send as values.

maybe ill make a toggle, so that if a gamepad is present, use one line, else use the modified version

thanks everyone!