ultraleap / UnrealPlugin

Ultraleap SDK for the Unreal Engine.
264 stars 68 forks source link

Rotationdata sign issue #93

Closed frizzlminizzl closed 3 years ago

frizzlminizzl commented 3 years ago

Hey everyone,

kind of a basic question: in the first picture... LeapBreakData ...what info does the Rotation in break LeapBoneData contain? If I'm "attaching" a body to the fingers, the body follows the movement of the individual fingertip, so that's clear. But I also tried combining the Rotators of the index, the middlefinger and the thumb and somehow, in playmode, the body than twiches.

So I printed the Rotation of the break LeapBoneData to the screen and found out, that sometimes, even though the hand is barely moving, pitch/ yaw or roll of a finger changes from 180° to -178° or something like that. In the following pictures you can see that the hand holds still while the rotationdata of the fingers (third row of the dark red Info) changes it's sign (+,-): Rotationtwitch_NR1 Rotationtwitch_NR2

So I guess my overall questions would be: How can I combine these three Rotators without getting this twich resp. how can I prevent the Rotator sign (+,-) to switch? Am I missing something basic?

Thanks guys!

JimSimons-UH commented 3 years ago

In Unreal, rotations are normalized to +-180 degrees, so -178 is actually close to 180 in a full 360 rotation. Make sure CombineRotators and Delta blueprint functions when calculating new rotations.

frizzlminizzl commented 3 years ago

Hi @JimSimons-UH , thanks for your response! This is helpful!

I thought for a while that i saw values bigger than 180° and was therefore a litle confused, of if the value range is 0 to 360° but i already figured out that it's between -180 and 180.

The second part is the one im still struggling with: I tried Combine Rotators for the Index, the Middle and the Thumb but the object still twiches around the individual sign changes, so I guess your mentioned Delta BP functions are important... what are those and how do I use them so that the object follows the movement of the fingers?

Thanks in advance!

Ultraleap-Dan commented 3 years ago

An alternative way to attach an object to the hand is by fixing the mesh to a socket on one of the fingers.

I have attached a screenshot showing how to attach a mesh to a socket to help you get started. image (22)