Level Props ambient animation question.
by Valentine Minitsky · in Torque 3D Professional · 02/18/2010 (6:34 am) · 2 replies
My game level will have several props objects such as trees, bushes, watermill etc. All of them have ambient animation. I'm already have DTS files of my props, and hooked up DSQ animation to them in shape editor. Checked it, animation playing fine in shape editor. Saved it in shape editor, which created .cs files with such code:
//--- OBJECT WRITE BEGIN ---
function Tree_002Dts::onLoad(%this)
{
%this.addSequence("core/art/shapes/Trees/tree02_anim_idle.dsq", "mySequence1", "0", "-1");
%this.renameSequence("mySequence1", "idle");
}
singleton TSShapeConstructor(Tree_002Dts)
{
baseShape = "core/art/shapes/Trees/tree_002.dts";
upAxis = "DEFAULT";
unit = "-1";
lodType = "DetectDTS";
singleDetailSize = "2";
ignoreNodeScale = "0";
adjustCenter = "0";
adjustFloor = "0";
forceUpdateMaterials = "0";
canSaveDynamicFields = "1";
};
//--- OBJECT WRITE END ---
All looks fine.
Than I created DataBlock from StaticShapeData DataBlock class. Source code:
datablock StaticShapeData(Tree02)
{
shapeFile = "core/art/shapes/Trees/tree_002.dts";
isInvincible = "1";
cameraMaxDist = "25.6331";
};
function Tree02::onAdd(%this,%obj)
{
%obj.playThread(0,"idle");
}
Try several ways to put that tree on the level in World Editor. Didn't find anyway except to put it as TSStatic from Object Editor -> Library -> Meshes. And it doesn't play any animation.
Next I found this tutorial - http://www.torquepowered.com/community/resources/view/1522 but it doesn't helped a lot. Or may be I did it wrong.
So the questions is?
1)Dose the tutorial in above link is working for T3D? If, yes. Can some body point me out in witch file should i put the source code from the tutorial and what additional script files should I have to make it work?
2)How to put that tree on a level with World Editor and have it's idle animation playing?
//--- OBJECT WRITE BEGIN ---
function Tree_002Dts::onLoad(%this)
{
%this.addSequence("core/art/shapes/Trees/tree02_anim_idle.dsq", "mySequence1", "0", "-1");
%this.renameSequence("mySequence1", "idle");
}
singleton TSShapeConstructor(Tree_002Dts)
{
baseShape = "core/art/shapes/Trees/tree_002.dts";
upAxis = "DEFAULT";
unit = "-1";
lodType = "DetectDTS";
singleDetailSize = "2";
ignoreNodeScale = "0";
adjustCenter = "0";
adjustFloor = "0";
forceUpdateMaterials = "0";
canSaveDynamicFields = "1";
};
//--- OBJECT WRITE END ---
All looks fine.
Than I created DataBlock from StaticShapeData DataBlock class. Source code:
datablock StaticShapeData(Tree02)
{
shapeFile = "core/art/shapes/Trees/tree_002.dts";
isInvincible = "1";
cameraMaxDist = "25.6331";
};
function Tree02::onAdd(%this,%obj)
{
%obj.playThread(0,"idle");
}
Try several ways to put that tree on the level in World Editor. Didn't find anyway except to put it as TSStatic from Object Editor -> Library -> Meshes. And it doesn't play any animation.
Next I found this tutorial - http://www.torquepowered.com/community/resources/view/1522 but it doesn't helped a lot. Or may be I did it wrong.
So the questions is?
1)Dose the tutorial in above link is working for T3D? If, yes. Can some body point me out in witch file should i put the source code from the tutorial and what additional script files should I have to make it work?
2)How to put that tree on a level with World Editor and have it's idle animation playing?
#2
02/18/2010 (9:33 am)
Yes! It worked, thank you very much. Now my level looks much cooler. Tnx again.
Associate Manoel Neto
Default Studio Name
datablock StaticShapeData(Tree02) { shapeFile = "core/art/shapes/Trees/tree_002.dts"; isInvincible = "1"; cameraMaxDist = "25.6331"; category = "Trees"; };Now your tree datablock should be listed in a folder called "Trees" in the "Scripted" tab in the library, and you can create a StaticShape (not TSStatic) directly from the editor.