Jump to content

[SOLVED] LeapMotion in Unigine


photo

Recommended Posts

Posted

Hi all,

I'm trying to integrate LeapMotion in Unigine.

First question is if Ungine plans to support this device in the near future. I don't want to spend time in something that is already in the Unigine kitchen.

 

Second question is about  coordinates conversion. LeapMotion and Unigine uses right-handed coordinated system but up is Y axis in LeapMotion. I want to find the fastest way to make these conversions (for Vector and Matrix types) because every frame hands and fingers parts must updated in Unigine environment.

 

Thanks.

Posted

Hi Ivan,

 

First question is if Ungine plans to support this device in the near future. I don't want to spend time in something that is already in the Unigine kitchen.

We don't have plans for LeapMotion integration.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Hey, Iván

 

Regarding your second question, for vectors it's super easy:

vec3 leapmotion_data; // data from leapmotion where y is up

// Common way
vec3 unigine_data = vec3(leapmotion_data.x,leapmotion_data.z,leapmotion_data.y);

// In UnigineScript it could be even shorter by using swizzles
vec3 unigine_data = leapmotion_data.xzy;

For matrices it's just a matter of swapping rows/columns inside matrix:

mat4 leapmotion_data; // data from leapmotion where y is up

// if the leapmotion matrices are row-major then you have to transpose them as unigine matrices are column-major order (like OpenGL)
mat4 unigine_data(leapmotion_data,1); // set this if leapmotion_data matrix is in row-major order

// C++ common way (swap two zy axes)
mat4 unigine_data;
unigine_data.setColumn(0,leapmotion_data.getColumn(0));
unigine_data.setColumn(1,leapmotion_data.getColumn(2));
unigine_data.setColumn(2,leapmotion_data.getColumn(1));
unigine_data.setColumn(3,leapmotion_data.getColumn(3));

// C++ faster way (swap data inside the matrix itself)
mat4 unigine_data = mat4(leapmotion_data);
swap(unigine_data.m10,unigine_data.m20);
swap(unigine_data.m11,unigine_data.m21);
swap(unigine_data.m12,unigine_data.m22);
swap(unigine_data.m13,unigine_data.m23);
  • Like 1
  • 4 months later...
Posted

@ivan.cuevas did you actually manage to integrate LeapMotion in Unigine?

Posted

Unfortunately this integration has a lower priority for us, it's stopped for the moment.

×
×
  • Create New...