Solved - Class reference issue


Hello -

I am working with LeapMotion 2. I made a LeapMotion class in which I access the index finger. All good there.

Then I have a particles class and I want the attractor to be the index finger. I’m getting an error and I think it’s because even though there is #include “LeapMotion.h” in the Particle.hpp, I’ve gotten the syntax wrong. I’ve been searching the web but no joy.

Can someone help? Thanks much, Rachel

in LeapMotion.cpp

  for (int f=0; f<5; f++) {
            ofPoint mcp = simpleHands[i].fingers[ fingerTypes[f] ].mcp;  // metacarpal
            ofPoint pip = simpleHands[i].fingers[ fingerTypes[f] ].pip;  // proximal
            ofPoint dip = simpleHands[i].fingers[ fingerTypes[f] ].dip;  // distal
            ofPoint tip = simpleHands[i].fingers[ fingerTypes[f] ].tip;  // fingertip
       indexF = simpleHands[0].fingers[fingerTypes[1]].tip;
       ofSetColor(185, 18, 185);
       ofDrawSphere(indexF.x, indexF.y, indexF.z, 20);

in Particle.cpp

if (isAttracting) {ofPoint attractPoint = ofPoint(indexF.x, indexF.y, indexF.z);

but I get the error

Use of undeclared identifier 'indexF'

I should mention - I also added ofPoint indexF; to the LeapMotion.h to create a global variable.

ofPoint indexF;

OK! fixed this - made left the ofPoint indexF in the LeapMotion.h but updated it in a loop in the ofApp.h. Cheers