Door Animation
by Peter K · in Torque 3D Professional · 06/21/2010 (6:44 pm) · 4 replies
Hi everyone,
I'm having a problem with getting an animated door I made in Milkshape to work. I've exported the dts and dsq and can add the door to the world editor with no problem but I can't seem to get the animations to work. I can see the animations in the shapeditor and they play fine there so I'm pretty sure the model is ok. I've tried using the console to test the door but am getting an unknown command as below.
==>door1.playthread(0,"dooropen");
<input> (0): Unknown command playThread.
I'm executing the door1.cs file which was generated by milkshape an looks like it was modifed by the engine when i added the sequences.
datablock TSShapeConstructor(Door1Dts)
{
baseShape = "./door1.dts";
sequence0 = "./door1_open.dsq open";
sequence1 = "./door1_close.dsq close";
};
function Door1Dts::onLoad(%this)
{
%this.addSequence("art/shapes/Doors/door1_open.dsq", "dooropen", "0", "-1");
%this.addSequence("art/shapes/Doors/door1_close.dsq", "doorclose", "0", "100");
}
I've poked around on this all day but with no success so any help/thoughts would be appreciated, I'm using 1.1 Beta 1 if your curious.
Thanks :D
I'm having a problem with getting an animated door I made in Milkshape to work. I've exported the dts and dsq and can add the door to the world editor with no problem but I can't seem to get the animations to work. I can see the animations in the shapeditor and they play fine there so I'm pretty sure the model is ok. I've tried using the console to test the door but am getting an unknown command as below.
==>door1.playthread(0,"dooropen");
<input> (0): Unknown command playThread.
I'm executing the door1.cs file which was generated by milkshape an looks like it was modifed by the engine when i added the sequences.
datablock TSShapeConstructor(Door1Dts)
{
baseShape = "./door1.dts";
sequence0 = "./door1_open.dsq open";
sequence1 = "./door1_close.dsq close";
};
function Door1Dts::onLoad(%this)
{
%this.addSequence("art/shapes/Doors/door1_open.dsq", "dooropen", "0", "-1");
%this.addSequence("art/shapes/Doors/door1_close.dsq", "doorclose", "0", "100");
}
I've poked around on this all day but with no success so any help/thoughts would be appreciated, I'm using 1.1 Beta 1 if your curious.
Thanks :D
About the author
#3
Interestingly, I tired doing it as a datablock and as a singleton yesterday with no luck. I guess a good night sleep and a couple of great suggestions are the key to success :)
Thanks guys!
06/22/2010 (10:16 am)
@Richard~ Thanks, that did the trick! Thank you so much! Interestingly, I tired doing it as a datablock and as a singleton yesterday with no luck. I guess a good night sleep and a couple of great suggestions are the key to success :)
Thanks guys!
Richard Marrevee
R.G.S - Richards Game Studio
Now let's make the door a staticshape by declaring a datablock as follows:
datablock StaticShapeData(doorDB) { shapeFile = "art/shapes/Doors/door1.dts"; //Your door.dts model goes here mass = "1"; // give it some mass and drag drag = "0.8"; category = "Door"; };Place this in art/datablocks/ as door1.cs
Now make sure you exec this file. Do this by adding this line
exec("art/datablocks/door1.cs");in art/datablocks/datablockExec.csNow completely remove the Door1Dts::onLoad function (the anims are already added in the datablock).
Save this file in the same folder as where door1.dts is located and name it door1.cs
After starting the world editor you can find the door in the script part of the shapes under Doors.
Add the door in the normal way and give it a name: Door1 or something you like.
Now to play the sequence you can type in the console:
Door1.playThread(0,open);
and
Door1.playThread(0,close);
Hope this will help you.