- Home /
Flip gameobject by 180º
Hello,
so I have a Gameobject that has 2 planes attached, each with a different material. One's visible from the front, the other from the back. I need to rotate the gameobject by 180º without moving its position, so that instead of seeing the front plane, I see the back plane. (The camera doesn't move) I've been searching and trying with .Rotate(),.RotateAround(),.rotation, etc. but I can't get to it without moving the gameobjects position.
I think I'm just having a hard time understanding how these work exactly, but I'm out of ideas righ now.
Basically what I need it to do: flip around the X or Y axis, just like when you rotate an object inside the editor.
Thanks in advance
Can you post your code? How did you generate your planes? One method that can solve this issues is to use an empty game object. Place the empty game object at the pivot point of your rotation and then make the two planes children. Put your rotation code on the pivot point object.
Damn, that was the problem...the empty game object wasn't in the centre of the planes, it was outside, that's why it was doing strange things when rotating.
Simple transform.Rotate works like I wanted it to now:)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Rotate GameObject using Coroutine 2 Answers
Plane - 10x10 grid - Questions about it. 1 Answer
Rotation problem 1 Answer
Minimum distance on configurable joint? 2 Answers