Hello
I have a question about the position of an object.
I want to let my ground follow the player object on top of it.
But I only want it to follow and the z of the player object and right now I only know how to let it follow the x, y and the z.
Here's the code that I have right now:
Could someone help me out?
I have a question about the position of an object.
I want to let my ground follow the player object on top of it.
But I only want it to follow and the z of the player object and right now I only know how to let it follow the x, y and the z.
Here's the code that I have right now:
C#:
public class StayUnderPlayer : MonoBehaviour
{
public Transform player;
public Vector3 offsetG;
void Update()
{
transform.position = player.position - offsetG;
}
}
Last edited by a moderator: