I have a Vector3 and a Quaternion, what is the best way to get the coordinates of a location a certain distance in front (or behind).
What I am trying to do is this:
Gizmos.color = Color.red;
var direction = transform.TransformDirection(Vector3.forward) * 1000;
Gizmos.DrawRay(transform.position, direction);
Just without access to the transform, but with the (Quaternion) rotation and and coordinates (Vector3)
If you multiply a world rotation with Vector3.forward
you will get the same as using the respective transform.forward
public Vector3 GetPosition(Quaternion rotation, Vector3 position, float distance)
{
Vector3 direction = rotation * Vector3.forward;
return position + (direction * distance);
}
You could use Ray
but that would be overkill
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With