Datablock confusion
by William James · in Torque Game Engine · 06/02/2007 (7:13 pm) · 6 replies
I have the book TGPGTT I know how to create a datablock and a instance of a datablock. Now this is where I'm confused, when I place the code below my object doesn't show when I start the mission editor. What am I doing wrong?
// create the datablock
datablock StaticShapeData ( SimpleTarget0 ){
category= "target";
shapeFile="~data/shapes/target/target1.dts";
};
// create object
new StaticShape(newTarget){
dataBlock = "SimpleTarget0";
position = "0 0 0" ;
rotation = "1 0 0 0";
scale= "1 1 1";
};About the author
#2
06/03/2007 (1:25 pm)
.
#3
So where would I place the code below? In the simpletarget.cs as a function or in the .mis file?
06/03/2007 (2:32 pm)
Okay I see Beserk. I never even thought to look in the .mis file. Now I see where I can change the properties of my shape. So where would I place the code below? In the simpletarget.cs as a function or in the .mis file?
SimpleTarget0::onAdd()
#4
Try going into the mission editor and placing your object. It should be found under shapes>target. If it doesn't place, check for errors in your console.
06/03/2007 (3:05 pm)
You don't need to add an onAdd() method in script. The object will be created fine without one.Try going into the mission editor and placing your object. It should be found under shapes>target. If it doesn't place, check for errors in your console.
#5
06/03/2007 (9:15 pm)
.
Torque Owner Daniel Buckmaster
T3D Steering Committee