- Home /
Animate projectile before throwing?
So essentially, I have a parent animator with parts that i want to animate, then launch.
The animator is set to not animate the launched piece after it is launched, but i get some really freaky errors when i try to Destroy() the launched object. it seems like the part references get switched around, and the same position and rotation changes apply to the wrong parts.
when i DON'T Destroy() it, all the animations are correct, however, the launched part gets sent on the right trajectory, but then moves immediately back to its root position from the editor...
Answer by theLucre · Dec 08, 2014 at 11:13 PM
The child object transform is hooked to the parent via the Animator Controller / Animation curves. Deleting the child will break the Animation curves (hence your Destroy() errors) and changing the Animation state will reset the children transforms depending on the curves you've setup in the key frame editor.
My suggestion: keep the projectiles as children of the parent, but DO NOT edit their transforms in the parent's Animation Controller. Animate them separately and use a manager to send messages to fire off those animations via scripts as needed.