Conversion to Unreal Coordiante system.

Post Reply
harvey3141
Posts: 2
Joined: Wed Mar 09, 2016 2:37 pm

Conversion to Unreal Coordiante system.

Post by harvey3141 »

Hi,

I'm working on a plugin for Unreal.

I'm streaming data in via the NatNet SDK successfully and setting positions, but I'm strugging with the conversion between the Motive and Unreal coordinate systems.

Unreal uses a Z-up, Left Hand system.

If had a look through the Untiy and SampleClient3D examples

In SampleClient3D there's a Z up to Y up quaternion conversion (ConvertRHSRotZUpToYUp) for RHS, so I think I need to perform kind of the inverse of this, while accounting for the fact that Unreal is LHS.a

Both Unity and Motive use a Y-up system, however Unity is LSH. In the Unity example (the unity project scripts not the UnitySample.exe) some sign changes are applied to the incoming quaternion which seem to change from RHS to LSH.

I've been trying to use a combination of these existing methods to convert correctly for Unreal but I don't seem to be getting anywhere. Do you have any suggestions?

I'm happy to share my repositiory once I've got the basics working.

Thanks,

Harvey
ZachBrockway
Posts: 8
Joined: Wed Oct 21, 2015 9:25 am
Location: Corvallis, OR

Re: Conversion to Unreal Coordiante system.

Post by ZachBrockway »

Hi Harvey,

Assuming Motive is set to stream Y-up (the default), something like the following should do the trick:

Code: Select all

const sRigidBodyData& rbData = /* ... */;

const FVector position( rbData.x, rbData.z, rbData.y );
const FQuat orientation( rbData.qx, rbData.qz, rbData.qy, -rbData.qw );

// ...code that uses "position" vector and "orientation" quaternion...
Hope that helps!
Zach Brockway
Senior Software Engineer | NaturalPoint
harvey3141
Posts: 2
Joined: Wed Mar 09, 2016 2:37 pm

Re: Conversion to Unreal Coordiante system.

Post by harvey3141 »

Great, thanks!

Here's the plugin should anyone be interested.

https://github.com/Harvey3141/Motive-UE4
Post Reply