Raycast and rotation

AndyC 1 year ago updated 1 year ago 2

Hi all,

I am using a Raycast on a game object. I'd like the position and direction of the Raycast to update with the game object it's attached to (it will be used as a pointer). The position is simple enough but I don't understand how this works with direction and rotation. 

Currently I have the direction set as 0, 0, 1, so the ray casts forward, how do I then get this to update with the rotation of the game object? 

Thanks in advance!


Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

I'm not sure if i understand you correctly. But is this what you want to know?

Or can you explain in more detail what result you are trying to achieve?


Hi Elin, thanks for replying, this worked! It was just Transform.forward I needed for direction.

Thanks again, much appreciated!