Deriving Objects from ShapeBase
by Juan Aramburu · in Torque Game Engine · 03/13/2006 (6:01 pm) · 1 replies
I am trying to add functionality to the engine by modifying the source code, and it seems that for what I'm doing the most natural thing would be to extend the ShapeBase class. I have done so, but when I attempt to place an object of the derived type into the game, it doesn't show up. If I change the derived object, to make it a child of TSStatic (as opposed to ShapeBase), then it shows up. I have been unable to find any information about sticking a derived class like this into the game, any help would be much appreciated.
Associate Alex Scarborough
bool StaticShape::onAdd() { if(!Parent::onAdd() || !mDataBlock) return false; //Custom setup stuff goes here... whee... addToScene(); if (isServerObject()) scriptOnAdd(); return true; }yourObject::onRemove should look something like this:
void StaticShape::onRemove() { scriptOnRemove(); removeFromScene(); //Custome remove code goes here Parent::onRemove(); }That should be enough to get a basic renderable object derived from ShapeBase. Let me know if you've already one that or if this doesn't work.