- Home /
Rotate whole scene by 90 degrees
I'm trying to make it so on collision the whole scene rotates 90 degrees so the walls become the floors. I can't figure out how to make my player use the walls as floor once the scene rotates any help appreciated thanks.
Show us an image if you can, and... why you rotate all the scene's objects and not the camera xd?
Answer by unidad2pete · Aug 19, 2017 at 01:23 AM
Make a empty gameObject to the scene, named " Map". Select all objects on your scene, and drag to Map gameObject ( not player or camera, only map objects) , making Map gameObject parent of all scene.
public GameObject Map;
public float angle = 90;
void Start()
{
Map = GameObject.Find("Map");
}
void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
Map.transform.Rotate(angle, 0, 0); // X axis
//Map.transform.Rotate(0, angle, 0); // Y axis
//Map.transform.Rotate(0, 0, angle); // Z axis
}
}
http://i.imgur.com/bku8F5w.png
You dont need change gravity direction, only rotate your map.
It is not disappearing, only are rotating, and maybe your map is out off screen because its rotating on X axis of Parent transform, and I dont know if you need rotate to X, Y or Z axis You need adjust to center the parent position to get your correct rotation, if your parent object is not on center, all objects rotates arround de parent.
I need to rotate by 90 on the z axis but it becomes out of sight and im not quite sure what you mean