scripting multiple objects behavior
ok so in my head I have this getting it to be functional is something else
I have 50 objects meshes that are children of Object A
I want each object to have behavior in this instance to spin on fame update
I don't want to manualy add a script to each object via the UI (not scaleable solution)
I was going for
// make each child SceneObject spin// @input float spinSpeed = 2.0
// @input SceneObject invadersvar sceneObj = script.invaders(); for(var i=0; i<sceneObj.getChild(); i++) {var spinTransform = script.sceneObj[].getTransform();
var spinVal = getTime() * script.spinSpeed;
spinTransform.setLocalRotation( quat.quatFromEuler( 0.0, spinVal, 0.0 ) );}
Hey Patrick! You definitely have the right idea :)
I took your code and added a function which is the update for a single invader. Then, you can just focus all invader specific code in that update. You pass in the parent object and it'll spin all the children.