# Track relative motion of fingers : Leapmotion

**URL:** <https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718>\
**Category:** Libraries\
**Created:** [February 25, 2019, 3:26pm UTC](https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718 "2019-02-25T15:26:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![piyushpohekar3003](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@piyushpohekar3003](https://discourse.processing.org/u/piyushpohekar3003)\
**Post date:** [February 25, 2019, 3:26pm UTC](https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718/1 "2019-02-25T15:26:01Z")

</div>

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/23915/leap-motion-processing)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.

Please refer the code available at the link above.  
I wanted to track finger-tips independently. But when I tried using ‘specific finger’ part of the code, i notices that the PVector values were changing even if I move my palm. Which means, it returns the independent position of fingertips in 3d space. But what if I have to track finger position with respect to the palm?

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [February 27, 2019, 6:43pm UTC](https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718/2 "2019-02-27T18:43:20Z")

</div>

I’m trying to be sure that I understand the question. Are you asking how to subtract the finger.getPosition from the hand.getPosition, using PVector.sub()?

[https://processing.org/reference/PVector\_sub\_.html](https://processing.org/reference/PVector_sub_.html)

---

<div class="post-metadata">

**Author:** ![piyushpohekar3003](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@piyushpohekar3003](https://discourse.processing.org/u/piyushpohekar3003)\
**Post date:** [March 3, 2019, 5:28am UTC](https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718/3 "2019-03-03T05:28:25Z")

</div>

Yes. But not always. It should know when the palm is moving and when the fingers are moving.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 3, 2019, 7:08pm UTC](https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718/4 "2019-03-03T19:08:02Z")

</div>

Well, that is what subtracting the hand.getPosition does. It expresses the finger as relative to the hand. Then, if the hand moves but the fingers (relative) don’t… they don’t. Because you are subtracting the hand, so nothing is moving.

---

<div class="post-metadata">

**Author:** ![piyushpohekar3003](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@piyushpohekar3003](https://discourse.processing.org/u/piyushpohekar3003)\
**Post date:** [March 4, 2019, 3:11pm UTC](https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718/5 "2019-03-04T15:11:59Z")

</div>

yes. that is okay if you have to do any one movement at a time. I wanted to track the finger tips simultaneously. Will that be possible?

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 4, 2019, 5:08pm UTC](https://discourse.processing.org/t/track-relative-motion-of-fingers-leapmotion/8718/6 "2019-03-04T17:08:48Z")

</div>

Well, you should try it and see if it works!

RelativeFinger1 = AbsoluteFinger1 - Palm  
RelativeFinger2 = AbsoluteFinger2 - Palm  
RelativeFinger3 = AbsoluteFinger3 - Palm  
…
