@stepofchange wrote:
I am sorry for my english . I do rope as follows:
for (int i = 0; i <= numRope; i++) { auto spRope = Sprite::create("rope.png"); spRope ->setAnchorPoint(Vec2(1, 0.5f)); auto _ropePhysicsBody = PhysicsBody::createEdgeBox(spRope->getContentSize(), PHYSICSBODY_MATERIAL_DEFAULT, 3); spRope->setPhysicsBody(_ropePhysicsBody); std::string name = "Rope"+to_string(i); spRope->setName(name); if (i == 0) { spRope->setPosition(visibleSize.width/2, plankSpriteUp->getPosition().y); PhysicsJointDistance* RopeJoint = PhysicsJointDistance::construct(egeBodyUp, spRope->getPhysicsBody(), Vec2(1,1), Point::ZERO); sceneWorld->addJoint(RopeJoint); }else{ std::string namePrev = "Rope"+to_string(i-1); spRope->setPosition(visibleSize.width / 2, this->getChildByName(namePrev)->getPosition().y- this->getChildByName(namePrev)->getContentSize().height); PhysicsJointDistance* RopeJoint = PhysicsJointDistance::construct(this->getChildByName(namePrev)->getPhysicsBody(), spRope->getPhysicsBody(), Point::ZERO, Point::ZERO); sceneWorld->addJoint(RopeJoint); } this->addChild(spRope); _sprites.push_back(spRope); }
when i run debuging, i getting error: Expression rotationZX == rotationZY CCNode.ccp line 293:
float Node::getRotation() const { CCASSERT(_rotationZ_X == _rotationZ_Y, "CCNode#rotation. RotationX != RotationY. Don't know which one to return"); return _rotationZ_X; }
Posts: 1
Participants: 1