- Home /
Child ignoring parent rotation?
Hi guys. I have a sphere rigidbody which I'm currently using to represent a character while in the prototyping stage of a project. Moving forward, I want to maintain the sphere rigidbody for collision, but turn of it's renderer and instead play a simple animation that shows a character running.
However, I want the animation (which will be a 2D anim) to always face the forward, effectively ignoring the rotation of the sphere (I'm assuming it would be the child of the sphere rigidbody) - so if you like, imagine the monkey in Super Monkey Ball, or a hamster in a ball - they both stay upright facing forward, while the sphere they are in rotates. I'm wondering how best to achieve this - is there anyway for a child to ignore or counteract it's parent rotation in an elegent manner? Or perhaps there's a simpler solution altogether.
Thanks for any suggestions
Answer by robertbu · May 21, 2013 at 01:34 PM
Instead of making the 2D character a child, just have the 2D character track the parent.
var track : Transform;
function Update() {
transform.position = track.position;
}
Or you could just reset the rotation each frame. You might have to do it in LateUpdate().
transform.roation = Quaternion.identity;
Of course! (always looking for the complicated answer). Thanks very much!
Your answer
Follow this Question
Related Questions
Make a simple tree 1 Answer
Child versus Parent rotations 3 Answers
Ignore parent Rotation 1 Answer
Rotating a parent object so that child is at the closest possible position to another object 1 Answer
force child rotation to zero? 2 Answers