Vehicle equivalent of Player::ActionAnimation
by Kimberly Unger · in Torque Game Engine · 10/06/2003 (4:35 pm) · 1 replies
Is there a functional equivalent to the Player::ActionAnimation logic for vehicles? What I'm looking for is a way to do %obj.setActionThread(.... for a player object based on 'vehicle' and not 'player'. What were trying to do is animate hatches opening and closing when looking at a vehicle in 3rd person.
Torque Owner Sam Guffey
// To open the hatch
obj.playThread(0, "sequence");
// To close it.
obj.setThreadDir(0, false);
// To re-open it
obj.setThreadDir(0, true);
"0" in these instances are an index number you are placing on this shape. Basically a slot, so any call to the slot will retrieve the sequence attached to it.
Say in the onAdd function you had 2 animations you wanted to add and control.
-- Insert
// This will automaticlly start the sequence forward.
obj.playThread(0, "hatch");
obj.playThread(1, "driverDoor");
// But since this is in onAdd we need to close them back.
obj.setThreadDir(0, false);
obj.setThreadDir(1, false);
-- End
Now that the animations are added and givin a slot number they will be easier to control later..
To open the door all you need to do is..
obj.setThreadDir(1, true);
The hatch..
obj.setThreadDir(0, true);
false to close them back.
Email me if you have any questions on anything.
Sam