Transform Right World Space

Hello , I need transform’s right vector but in a world space , I am attaching the screenshot of detailed explained my problem.

currently transform.right not working because I need right side of airplane not rotated right side.

World right is Vector3.right… is that what you want?

Otherwise you could always flatten and normalize the transform.right value.

Vector3 right = transform.right;

right.y = 0;
right.Normalize();

actually I need transform.right in the case of Euler angle of transform Z = 0 value

Vector3.right is static, I need transform.right but in case of local Euler angle for Z angle = 0;

i will try your code.

your code does not worked, green line indicated your ray

https://www.dropbox.com/s/8zla79r5u0vm4at/Screen%20Shot%202022-07-24%20at%2002.24.36.png?dl=0

in this case my direction should be black color or Y axis

I need to set transform Euler of z Value = 0 after than I need to get transform.right but which efficiency way?

what you want is not worldspace since if it was it would be static, so you more or less want the local right, but without z axis rotation effecting it.

I have not tested it but you should be able to get your transform.right then multiply it be the opposite of your z rotation

Quaternion.Euler(0f, 0f, -transform.eulerAngles.z) * transform.right

yeah this solved my issue!

I think they are same stuff!

Vector3 leftDir = Quaternion.AngleAxis(transform.localEulerAngles.z * -1f, transform.forward) * transform.right;

Also, since you’re flying airplanes in Unity, did you know about this awesome Unity flight sim package?

https://github.com/gasgiant/Aircraft-Physics

Worked perfectly with almost zero integration… it forms the core of my Pilot Kurt game.