Game Development Community

Vehicle Gas/Brake Animations

by CSMP · in Technical Issues · 01/25/2008 (1:21 am) · 6 replies

Im trying to add simple 3-4 frame gas/brake animations to a custom vehicle and im not seeing where i would link the animations into the vehicle move code or is there more to it than that?

because ive been looking through the player.cs and saw that they linked the animations and called for a deathanimation but i dont see how the movement animations are called... or maybe ive been looking in the wrong areas?

and also would i be able to add a "leaning" sideways animation to the vehicle and get both gas and "lean" animations to play at the same time

sorry if im asking for much

#1
01/28/2008 (10:54 pm)
I think you would be able to make the vechile looks as if it were leaning using setTransform(); The last 4 parameters are related to rotation somehow, maybe "x, y ,z and rotation" (meaning that if you pass a value of "1 0.5 0 0.5", the model would rotate 90 degress on the x axis, 45 on the y axis and none on the z axis. This would look quite silly if your model is not some kind of hovervechile, but since we all know that futuristic racers set in cyberpunks settings are aproximatly 500 times cooler than a standard GTA racer, you are probably aiming for that? Regarding the animations, there are some kind of setAction(%target, %animation); function that makes target item play given animation. Although i belive this animation is broken as soon as any other animation is triggered.
#2
02/17/2008 (12:19 am)
I really appreciate the help, i think with some work i might actually get that to work not as animations but a vehiclemovent function that physically moves/blends to the appropriate "stance" thus creating a handling and objectview differance, gonna be pretty complicated but either way thank you ted.


now i dont have to do animations!
#3
02/17/2008 (1:07 am)
IFL animations are what's usually used for brake lights. I believe there's even a "how to" for it somewhere on TDN, in the artists section.

I'm not sure what you mean in terms of "vehicle leaning." If your vehicle is a motorcycle, then check out the hovervehicle code for clues on how to do it. They lean over as they steer.
#4
02/17/2008 (6:39 am)
There is a stock 'brake' animation sequence tied to the Vehicle Class....there are some caveats, I believe. It will be in the difference in 'mounting' the playerAvatar to the vehicle or 'being' the car shape. The 'dismount' calling is initiated by the Space bar key action input, however; this is key is used for the 'jump' of the playerAvatar, so it depends upon how your implementation of the player Class object is handled.

Now, you can get extra cool and make a new 'command' to 'brake' the vehicle and bind a key input that 'action'...and then I believe the 'braking' sequence called by default Vehicle code would allow the animation to play on cue.

Please, anyone knowing different please correct the submitted observation....

Thanks.
#5
03/25/2008 (12:02 am)
Ok, i have figured out the "Leaning(Turning)/Gas/Brake Effects" of the vehicles by modifying the Vehicles Datablock to:

mass = 200; //mp: was 180
massCenter = "0 -0.4 0.8"; //mp: moved the massCenter forward(?) and higher up
//massBox = "0 0 0"; //mp: not needed or errors


P.S. Thank you everyone, what i was asking before may be a little more difficult then i was thinking originally however these changes have provided an alternate and maybe more effective way of making a WheeledVehicle act with a momentum effect


Rex: Thank you for the info, i will look into it some time soon
#6
03/25/2008 (10:09 am)
MassBox sets up the vehicle inertia. If you leave it at default, WheeledVehicle will use the size of the vehicle's bounding box to calculate the inertia values.

MassBox is a hideously evil concept anyway. Better to change the code for more flexibility.

Using a massCenter y value of -0.4 means miving the center of mass backwards 0.4 m from the objects origin.