Hi.
If I assign a rotation to a transform then I can use transform.forward to find out the direction the transform is looking.
I want to do that but without having to pass it to a transform.
Like, myQuaternion.forward/right/up
How do I do that?
Hi.
If I assign a rotation to a transform then I can use transform.forward to find out the direction the transform is looking.
I want to do that but without having to pass it to a transform.
Like, myQuaternion.forward/right/up
How do I do that?
I could be wrong, but it seems to me there needs to be some sort of link between these properties.
You cannot do myQuat.forward, as forward is not a member variable of Quaternion. You will need to pass the information from the Quat to the Transform or vice versa.
Hi.
Thanks but I actually found the solution.
I know you can’t do myQuat.forward but that’s what I would like to do.
The solution was myQuat * Vector3.forward, that simple
![]()
Oh nice work. I hate vector/quaternion math. ![]()
Me too
I may not fully understand this but doesnt that just orient the rotation of your quaternion to be 0,0,1?
Or was that what you wanted to happen?
Let’s say I want to draw a line in the forward direction of a quaternion.
var myQuat = Quaternion.Euler (10,20,30);
Debug.DrawRay (transform.position,myQuat*Vector3(0,0,1));
And that will do it (I think, code not tested)
I don’t change the quaternion since I only use it, I don’t assign it to be something.
I dont know if I may post only a THANKS!
But THANKS! This saves me.
Likewise thanks. ![]()
God bless people who find their own answers but still post them.