- Home /
How to get the direction vector given a point and rotation?
So basically I have the player position and its rotation value. How can I get the facing direction so i can use that for raycast.
Thank you.
Comment
Answer by AbominationGames · Aug 20, 2017 at 05:31 AM
You should be able to use .forward in order to raycast in the direction you are facing.
https://docs.unity3d.com/ScriptReference/Transform-forward.html
To further elaborate on this, transform.forward is already calculated like this by Unity:
// This is already the value of transform.forward -- you don't need to actually use this
transform.forward = transform.rotation * Vector3.forward;
Your answer
Follow this Question
Related Questions
Linear equations in Unity? 2 Answers
Why i can't see my questions ? 2 Answers
Making My Raycast Face The Right Direction 3 Answers
bullets fly to the wrong direction in specific situations 0 Answers