OnUpdate for object created inside behavior
by Man-Machine · in Torque Game Builder · 04/08/2009 (2:31 am) · 3 replies
I have this code on a behavior function:
%projectile = %this.missile.cloneWithBehaviors();
%projectile.enableUpdateCallback();
Now how do I use this object on a OnUpdate callback function inside the behavior. Or is it not possible?
Thank you
%projectile = %this.missile.cloneWithBehaviors();
%projectile.enableUpdateCallback();
Now how do I use this object on a OnUpdate callback function inside the behavior. Or is it not possible?
Thank you
#2
04/08/2009 (9:50 am)
Thanks but I couldn't get that to work. There must be more to it...
#3
Something like this should get the update callback working
04/08/2009 (11:34 am)
Oh I just see that your attempt to enable the update callback won't work.Something like this should get the update callback working
function YourBehavior::onAddToScene(%this, %scenegraph)
{
%this.owner.enableUpdateCallback();
}
function YourBehavior::onUpdate(%this)
{
// some code...
}
Torque Owner Shaderman
And have some code in an onUpdate function like this:
function SomeClass::onUpdate(%this) { // put some code here }