Hey!
I need quick help!
I am trying to make a platform game. I started with the physics part. The problem is that, even with no input, my body jumps automatically. I don’t understand why. Can anyone please explain?
My Player’s Body:
mPhysicsBody = PhysicsBody::createBox(getContentSize(), PhysicsMaterial(0.1, 0.0, 0.5));
mPhysicsBody->setDynamic(true);
mPhysicsBody->setMass(120);
mPhysicsBody->setRotationEnable(false);
My Ground:
mGroundSprite = Sprite::create();
mGroundSprite->setAnchorPoint(Vec2(0, 0));
mGroundSprite->setPosition(0, 0);
mGroundSprite->setContentSize(Size(size.width, -50));
mGroundBody = PhysicsBody::createBox(Size(size.width, -50), PhysicsMaterial(1, 0.0, 0.5));
mGroundBody->setDynamic(false);
My Physics World:
scene->getPhysicsWorld()->setGravity(Vec2(0, -350));