Hey guys,
In my game players can create objects and place them. Once they choose the object they want to create it will constantly stay infront of them until they press the button to place it. It is constantly kept infront of the player via this code in an Update() function:
Vector3 pos = placingPlayer.transform.position + (placingPlayer.transform.forward * 1.5f);
this.gameObject.transform.position = pos;
this.gameObject.transform.rotation = placingPlayer.transform.rotation;
This keeps the object infront of the player at the player’s height, but I would like the height to adjust according to where the player is looking. If they are looking up I would like the height to increase, and if they are looking down it be closer to the ground etc. Does anyone know what I have to add to get this to work?
The character I am using is the FirstPersonController from the Characters Asset Package. Thanks!