Hello,
I have the current object rotation, how do i calculate the position in front of my object 2 units away? I am trying to figure out where my players is looking at and Instantiate a cube ate the position 2 units away.
Hello,
I have the current object rotation, how do i calculate the position in front of my object 2 units away? I am trying to figure out where my players is looking at and Instantiate a cube ate the position 2 units away.
If your model has the z (blue) axis as the forward directional vector, then use this:
Instantiate(cubePrefab, player.transform.position + player.transform.forward * 2, Quaternion.identity);