Hi folks, I asked this question in the addons page (github), the only response was mine so far.
I am trying to get the particle coordinates to do something if they are between certain boundaries.
The way I am doing it is as follows, I don’t know if it’s the best way to do it, (it seems to work):
void testApp::contactStart(ofxBox2dContactArgs &e) {
if(e.a != NULL && e.b != NULL) {
if(e.a->GetType() == b2Shape::e_edge && e.b->GetType() == b2Shape::e_circle) {
//some checks and sentences I do
ofVec2f p;
const b2Transform& xf = e.b->GetBody()->GetTransform();
b2Vec2 pos = e.b->GetBody()->GetLocalCenter();
b2Vec2 b2Center = b2Mul(xf, pos);
p = worldPtToscreenPt(b2Center);
cout << "p.x " << (int)p.x << " p.y " << (int)p.y << endl;
if (p.y < sp->pGround1.y - 25) // menos restrictivo
{
bData->bHit = true;
sound[bData->soundID].play();
}
}
}
}
Thanks for any suggestion, cheers!