Hi everyone
I create two physics body (Boxes) and I`m try use for them PhysicsJointDistance.
But when I run project I see that my application has crashed
If I remove code with PhysicsJointDistance, my application is good working…
This code I put in init function:
// physics body 1
auto sp_1 = Sprite::create("CloseNormal.png");
sp_1->setPosition(Vec2(visibleSize.width/3, visibleSize.height/2));
auto body_1 = PhysicsBody::createBox(sp_1->getContentSize(), PhysicsMaterial(0,1,0));
sp_1->setPhysicsBody(body_1);
this->addChild(sp_1);
// physics body 2
auto sp_2 = Sprite::create("CloseSelected.png");
sp_2->setPosition(Vec2(visibleSize.width/2, visibleSize.height/2));
auto body_2 = PhysicsBody::createBox(sp_2->getContentSize(), PhysicsMaterial(0,1,0));
sp_2->setPhysicsBody(body_2);
this->addChild(sp_2);
// joints
auto joint = PhysicsJointDistance::construct(body_1, body_2, Vec2::ZERO, Vec2::ANCHOR_TOP_RIGHT);
joint->setCollisionEnable(false);
//joint->setDistance(50);
sceneWorld->addJoint(joint);