Creating StaticShape object from C++ code
by M Mahmud Hasan · in Torque Game Engine · 04/23/2007 (11:33 am) · 3 replies
Hi,
I am facing a problem creating staticShape objects from C++ code. I problem is somewhat as following:
I have a datablock staticShapeData which is as follows:
datablock StaticShapeData(heliCopter)
{
Category = "Misc";
ShapeFile = "~/data/shapes/iroquis/iroquis.dts";
//damaging
maxDamage = 500.0;
destroyedLevel = 450.0;
//explosion
explosion = heliExplosion;
debrisShapeName = "~/data/shapes/crossbow/debris.dts";
debris = defaultHeliDebri;
};
And somewhere in the code I use this data as follows:
new StaticShape(){
datablock = heliCopter;
};
Now I want to create the same kind of datablock and a staticShape from my C++ class.
I want to use that datablock in a staticshape also from C++ class. I am not sure how to do that.
We have the staticShapeData structure in staticShape.h. My question is is it okay to create
an object from that structure and then initialize it using required data? But i didn't get any idea how to
init the ShapeFile in the staticShapeData.
Moreover I have a callback console function for the staticShape object which is as follows:
function heliCopter::onAdd(%this, %obj)
{
%obj.playThread(0,"iflanim");
%obj.playAudio(0, heliEngineSound);
}
How can i create similar kind of callback function in c++ class?
Thank you in advance.
I am facing a problem creating staticShape objects from C++ code. I problem is somewhat as following:
I have a datablock staticShapeData which is as follows:
datablock StaticShapeData(heliCopter)
{
Category = "Misc";
ShapeFile = "~/data/shapes/iroquis/iroquis.dts";
//damaging
maxDamage = 500.0;
destroyedLevel = 450.0;
//explosion
explosion = heliExplosion;
debrisShapeName = "~/data/shapes/crossbow/debris.dts";
debris = defaultHeliDebri;
};
And somewhere in the code I use this data as follows:
new StaticShape(){
datablock = heliCopter;
};
Now I want to create the same kind of datablock and a staticShape from my C++ class.
I want to use that datablock in a staticshape also from C++ class. I am not sure how to do that.
We have the staticShapeData structure in staticShape.h. My question is is it okay to create
an object from that structure and then initialize it using required data? But i didn't get any idea how to
init the ShapeFile in the staticShapeData.
Moreover I have a callback console function for the staticShape object which is as follows:
function heliCopter::onAdd(%this, %obj)
{
%obj.playThread(0,"iflanim");
%obj.playAudio(0, heliEngineSound);
}
How can i create similar kind of callback function in c++ class?
Thank you in advance.
Employee Michael Perry
ZombieShortbus