- Home /
Why this flip rotation only works for parent, but not child?
Need to flip a 2D MC around Z-axis and keep shot on the X-Y plane at the same time.
Here is the code I used for the flip to the MC Parent Gameobject:
transform.localScale = new Vector3 (-1f * transform.localScale.x, transform.localScale.y, transform.localScale.z);
It looks OK. But the muzzle child inside the MC Gameobject doesn't flip.
MuzzleTransform = transform.Find ("Parent/Weapon/LaserGun/Muzzle");
MuzzleTransform.position seems not perfectly flipped.
How to fix this bug or there is better way to flip the MC?
Thanks in advance!
Comment
Why are you trying to adjust the local scale? What's wrong with?
//flips across the Z axis, stays in X-Y plane
transform.eulerAngles += (0,0, 180);
or alternatively
transform.localEulerAngles += (0, 0, 180);
Your answer
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
2D spaceship rotation 0 Answers
Localscale-flipped 2D character retains original rotation since 5.4 2 Answers
2D rotation question 0 Answers
Rotate/Flip Image in Unity 2d using Virtual Joystick 1 Answer