Search code examples
c#unity-game-enginegameobject

Make all cubes face a single point in Unity?


I am trying to create a circle of cubes that all face a common middle point in Unity. I was wondering if there is an easier way to face them all inwards than individually rotating each one. They need to be able to fall together, so the middle point must always be at the middle of the circle, meaning that they will be moving with the point moving with them and there can't be any rotation other than in the x-z plane. Any help would be great!


Solution

  • You can use transform.LookAt().

    gameObject.transform.LookAt(gameobjecttolooktowards.transform);