# @orient attribute to @N an @up?

## Recommended Posts

Hi everyone!

Is there a way to calculate @N and @up from the @orient attribute?
Basically the same as the orient to curve SOP does - it only outputs N and up, but i got all the Pitch/Yaw/Roll bells and whistles.

I have everything layed out on my curve the way i want, but Unreal Engine doesn't seem to read the orient attribute.

##### Share on other sites

Convert quaternion to matrix3 and extract rotation vectors from it.

##### Share on other sites

Hi Ronald, here is the extraction of axes from quaternion in vex:

```matrix3 m = qconvert(p@orient);

v@xaxis = set(m.xx, m.xy, m.xz);
v@yaxis = set(m.yx, m.yy, m.yz);
v@zaxis = set(m.zx, m.zy, m.zz);```

The default orientation of v@N is zaxis, and @up is yaxis. So this is probably what you need:

```matrix3 m = qconvert(p@orient);

v@up = set(m.yx, m.yy, m.yz);
v@N  = set(m.zx, m.zy, m.zz);```

##### Share on other sites

Wonderful, thank you!
Works like a charm

##### Share on other sites

Another quick way to do this is to just rotate world N (+Z) and world up (+Y) by your orient quaternion.

```v@up = qrotate(p@orient, {0,1,0});
v@N = qrotate(p@orient, {0,0,1});```

• 2
• 1

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×