Controlling moving of character using nuitrack sdk

Hello ,

I am trying to create a unity game using nuitrack sdk and intel realsense 415D, which I want to know if the user moves left or when he moves right and jump. i found another question was asking that if we can detect jump without the distance of joint to floor.
can you advise me how to start and how can I detect this actions?.

@iosif.semenyuk can you help ?

Dear Ahmed Osman!

Try to use this script. To track the user’s movement left-right (relative to the body position), you need to save the previous position of the target joint, such as the torso, and compare it with the new one obtained in the current frame.

To determine the direction of displacement, we denote the “left” vector for the skeleton as a vector from the position of the right shoulder to the position of the left. Next, we need to get the displacement vector of the target joint as the difference between the vectors of the new position and the old one.

The last step is to use Vector3.Dot function, which returns value < 0 if the user moves to the right and value > 0 if to the left.

In the example script, a more detailed detection logic is implemented, taking into account “does not move”.

As for jumping. Nuitrack does not have a built-in function for detecting а jump, you need to check the distance to the floor for any joint, for example, LeftHip or RightHip.

Please let me know if you have any other questions.

Addition to the previous post.