Page 1 of 1

Conversion to Unreal Coordiante system.

Posted: Wed Mar 09, 2016 3:18 pm
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

Re: Conversion to Unreal Coordiante system.

Posted: Thu Mar 10, 2016 4:45 pm
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!

Re: Conversion to Unreal Coordiante system.

Posted: Sat Mar 26, 2016 10:56 am
by harvey3141
Great, thanks!

Here's the plugin should anyone be interested.

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