How can i add a new tree via script?
by Bauer Ren · in Torque Game Engine · 07/07/2005 (3:11 am) · 3 replies
How can i add a new tree-object via script?
what is the concrete code for a new tree (or another object)?
Thanks for reply
t00cg
what is the concrete code for a new tree (or another object)?
Thanks for reply
t00cg
About the author
Recent Threads
#2
the added object (tree) should be now under the MissionGroup or not?
i can't see the added tree in the Mission Inspector. (even if i add it with MissionGroup.add())
should this be like this?
thanks for reply
t00cg
07/07/2005 (7:02 am)
Hmm my simple problem now is the following:the added object (tree) should be now under the MissionGroup or not?
i can't see the added tree in the Mission Inspector. (even if i add it with MissionGroup.add())
should this be like this?
thanks for reply
t00cg
#3
$instantGroup = MissionGroup;
The instant group is where objects are added if they are created with no explicit parent.
07/07/2005 (9:48 am)
Set the instant group before you create the object.$instantGroup = MissionGroup;
The instant group is where objects are added if they are created with no explicit parent.
Torque Owner Thijs Sloesen
Scattered Studio
Here's something taken from another topic:
A snippet of code that shows how to programmatically create objects in the mission using script:
// pos = position function createTree(%pos) { %tree = new TSStatic() { shapeName = "~/data/shapes/trees/tree1.dts"; }; MissionCleanup.add(%tree); %tree.setTransform(%pos); return %tree; } // call this function like this: // make sure %lx, %ly and %lz are valid x, y and z coordinates %pos = (%lx SPC %ly SPC %lz SPC "0 0 1 0"); createTree(%pos);Note: I am not sure this is "network safe" - I have not looked into that yet.