Draw a ray from a gamobject and keep direction of the ray relative to the gameobjects rotation.

I am drawing a ray like this:

 Debug.DrawRay(transform.position, new Vector3(1,1,1), Color.green, 1.0f / 60.0f);

But when i rotate the game object in x, y or z the direction of the ray is constant. I want to modify the direction so that it is relative to the game objects rotation:

I have looked at the quaternion functions and found that using something like this Quaternion.FromToRotation(transform.forward, transform.right) * new Vector3(1, 1, 1)
might do the trick. But i don’t understand what exact arguments i should give the function to make the direction rotate correctly in every axis.

Okay, i just triedtransform.rotation * new Vector3(1, 1, 1) and it worked. I do not really know why it worked though. Could any one explain it?