Hello, I’ve just started working with Unity and I’m having a hard time figuring out how to do basic direction dependent positioning.
So I’ve set up a simple scene. There’s the leader object and a few follower objects. The leader is given a command to move to a certain location on a field. The other objects follow him and group behind the leader at the destination point. Here’s how it works right now:
Hello, what you need to do is simple. when the player clicks on the position where the leader needs to go create an empty GameObject in this position (let’s call it “marker”), give “marker” the rotation of the leader.ex:
First you can make the followers a child of the leader. This will make them stay in the same position relative to the leader, but if the leader rotates, the followers will rotate as well.
The second way is put a script on the followers. Make it find the difference between the leaders position and it’s position at the start. Then set it’s transform every frame to the leader’s position subtracted by the initial difference: