Iterating over all sceneobjects in a behavior
by Joe Spataro · in Torque Game Builder · 04/16/2007 (6:47 pm) · 3 replies
What is the script to iterate over all scene objects from within a behavior?
i imagine its something like
thanks,
joe.s
i imagine its something like
for ( %i = 0; %i < %this.owner.scenegraph.getSceneObjectCount(); %i++ )
{
// is there a way to get sceneObject %i ??
// %this.owner.scenegraph.getSceneObject() doesn't take an index
// what to do?
}thanks,
joe.s
#2
04/17/2007 (9:33 am)
Actually, t2dSceneGraph::getSceneObject() does take an index. There is probably just a misprint in the documentation.
#3
$YourVariable Should be a Sim Set();
I hope this sample helps you out :)
04/30/2007 (3:23 pm)
for(%i = 0; %i < $YourVariable.getCount(); %i++) //to get count
{
%yourObject = $YourVariable.getObject(%i); //to get object
if(%yourObject.isOnline $= true)
{
%yourObject.yourFunction();
}
}$YourVariable Should be a Sim Set();
I hope this sample helps you out :)
Torque Owner Jemand den es nicht gibt