Keeping object constantly in front of player

Hello,

I want to keep 1 object constantly in front of my player, even if my player is rotated, I still want to object to be in front of it. My transform.forward appears to be going down on the y value instead of forward on the x value.

Anyone know how to keep an object constantly in front of another, no matter the rotation?

// paste your code here

If the forward (blue axis) is pointed downward, then your player is probably not rotated ideally. But, you can try transform.right or transform.up, depends on what the rotation of the player is.

1 Answer

1

The easiest thing to do is to make that object a child of your player in the Editor. If your game is first person, then make the object a child of the player camera. No need for any scripts.