Hello. I’m trying to make a raycast from a position to a direction based on transform.forward.
Here is what i’m doing :
Vector3 rotation = m_Rigidbody.transform.forward;
rotation = Quaternion.Euler (0, 45, 0) * rotation;
Debug.DrawRay (m_Rigidbody.transform.position + m_Rigidbody.centerOfMass, rotation, Color.red, 0.5f, false);
Basically i’m multiplying the forward vector by a quaternion.
With Quaternion.Euler(0, 45, 0) i obtain this : 0, 45, 0 - YouTube
It’s the expected result. As you can see, the red ray is at 45 degrees around the y axis, based on the forward vector.
With Quaternion.Euler(45, 0, 0), i expect it to be oriented by 45 degrees around the x axis, to make it point to the ground or to the air. But, this is the result : 45, 0, 0 - YouTube
It’s not constant, why ?
What is the problem ?
Thanks you !