I have a question about controllers . Is there anyway to tell a controller when you're done animating my node
remove yourself from the node ?
thanks
You can use setActive() as a way to tell the controller that it is not active… You will, however, have to put a control statement in your update method that says something like:
if(isActive()){
// do animation
}
else{
// skip animation... or return from the method
}
if you really want to remove it from the Node, you can make an isFinished method in the controller that you can poll until the animation is finished, and then remove it from the Node..
But i think polling every possible controller in nodes each time is not effective and will reduce performance when there are
a lot of controllers . I want the controller to automatically remove itself from its parent when its done animating the node ,
that way i could just make controllers and pass them to nodes ( i'm dealing with lot of nodes ) and not worrying what will
happen later . busy waiting is not a good strategy i think
Well,…tell use the usecase!
1)Do you speak of controllers you create yourself?
Or
2)controllers that alreadys exist?
- you need a reference to the node the controller is added and after you finished your work, you can do:
parentNode.removeController(this);
2) there I would really create a controller that checks the state of the other controller...
umm no actually i want to create a BezierCurveController with a complex path and pass it to a node and
i require it to remove itself from the node and i dont know anything about the time it finishes .