multiple Animation threads for vehicles
by Anthony Rosenbaum · in Torque Game Engine · 07/21/2002 (3:38 pm) · 7 replies
I have a flyer that has a cotpit that open and closes(animation 1) as the player mounts, in addition I added controls so that the flyer's jet changes direction depending on if they are gonig forward or hovering(animation 2). I noticed that when I use this additonal controls (aniamtion 2) I loose control of the cotpit controls (animation 1). It seems there is only ONE thread that gets attached to the vehicle. The playThread() function take a vaiable to store the thread in, but I find that it only hold the last used Thread you can't for example set an EngineThread than a DoorThread. can anyone help with this?
About the author
#2
So this means to me, i can define more than one sequence in a dts model ("ambient" is define in the milkshape file as material)
08/28/2002 (12:23 am)
maybe i'm wrong, but i found this in Rick Gorman's Scripting TutorialsQuote:
function Flag::onAdd(%this,%obj)
{
// %obj is the object being added to the world
// with %this datablock. Start up a thread on the
// new object. Since the ambient sequence is cyclic
// this animation will run continously.
%obj.playThread(0,"ambient");
echo("onAdd");
%obj.isPlaying = 1;
}
So this means to me, i can define more than one sequence in a dts model ("ambient" is define in the milkshape file as material)
#3
08/28/2002 (1:21 am)
That's a good tip. Thanks. However, the animation of my vehicle's tires needs to be controlled, e.g. forward and reverse, etc. Will this approach still work?
#4
08/28/2002 (1:25 am)
Woops, you're scripting this animation. That would work for objects that are just animated eye candy i think. I'm sure I've got to change the engine to do what I want to do.
#5
in the example
I require the controls to activate a "door_open" and "door_close" when the player mounts and dismounts WHILE using an "engines_up" or "engines_down" threads determined by if a key is press when the player is mounted. I think the code only supports 1 thread at a time. Would Blending be what I need?
08/29/2002 (5:40 pm)
My problem is a little more advanced than the tutorial.in the example
function Flag::onAdd(%this,%obj)
{
// %obj is the object being added to the world
// with %this datablock. Start up a thread on the
// new object. Since the ambient sequence is cyclic
// this animation will run continously.
%obj.playThread(0,"ambient");
echo("onAdd");
%obj.isPlaying = 1;
}the sequence "ambient" is played most likely it is a cyclic sequence that gets repeated.I require the controls to activate a "door_open" and "door_close" when the player mounts and dismounts WHILE using an "engines_up" or "engines_down" threads determined by if a key is press when the player is mounted. I think the code only supports 1 thread at a time. Would Blending be what I need?
#6
In milkshape you should have to add the two animations in "materials" like this
"opt: fps=5, cyclic
seq: Mountanimation=1-10
seq: UnMountanimation=11-20"
hope, i'm not totaly wrong ;)
[edit]uppss, the second animation should have it's own slot ;) => ...playThread(1, ....)[/edit]
08/30/2002 (3:28 pm)
have you tried such like this ???function Armor::onMount(%this,%obj,%vehicle,%node)
{
...
%obj.isPlaying = 0;
// maybe you won't need this, but it's always good, stopping the animation befor you change the thread ;)
%obj.playThread(0,"Mountanimation");
%obj.isPlaying = 1;
...
}
function Armor::onUnMount(%this,%obj,%vehicle,%node)
{
...
%obj.isPlaying = 0;
%obj.playThread(1,"UnMountanimation");
%obj.isPlaying = 1;
...
}In milkshape you should have to add the two animations in "materials" like this
"opt: fps=5, cyclic
seq: Mountanimation=1-10
seq: UnMountanimation=11-20"
hope, i'm not totaly wrong ;)
[edit]uppss, the second animation should have it's own slot ;) => ...playThread(1, ....)[/edit]
#7
08/31/2002 (1:59 pm)
The problem I have with that code , cause I tried somthing similar, is this. My vehicle has a place for the pilot with a cotpit then 2 ppl can ride on the skids. If I do it like that then ALL playes who mount/unmount will cause the cotpit to open. . . . .so then I use a variable called "isPilot" which works for mounting fine, but if I use it for dismounting well by the time it checks to see if the player isPilot the player is already dismounted so the test becomes invalid.
Torque Owner Robert Brower
I want to replace the wheels with legs that are animated in the dts file.
So far I have changed the wheel radius calulation so it doesn't divide by 2 so that the shoulder is the hub. And I've commented out the code in the engine that rotates the wheels. I have legs now on the buggy that are facing the right direction when I steer but they do not animate.
I've read WheeledVehicle.h and WheeledVehicle.cc many times and I tried a few idea but I'm getting nowhere.
Has anyone tried anything like this?