transform.LookAt

I need to create a round wall. I’ve made a cube and maked it thiner - it’s a part of the wall.
Then i instantiated these parts in a circle. First step done. But these parts don’t look at the center.
I used LookAt and it’s done! But when i rotate platform ( wall in standing in the platform and to move with this platform, i made wall - a child of the platform ), parts of the wall start to rotate in a strange way, breaking order.


What i can do? Is it possible to stop lookAt function, while parts of the wall will still look at the center?

If this circle only happens once, then a possible solution would be to call LookAt() in Start(), and then make each ‘thiner’ a child of the platform. Or you could use Quaternion.LookRotation() in the Instantiate() call to orientate each wall element.

If the circle changes at runtime, then you will need to call LookAt() during play. LookAt() has an optional second parameter that defines the ‘up’ direction. You need to pass the normal of the platform as this second parameter to your LookAt() function. If you platform is a Unity Plane or if you built your circles on top of a Unity Cube, then you can use the transform.up of the platform as the second parameter in the LookAt() call.