fix gravity direction (#18282)

This commit is contained in:
minggo 2017-09-19 09:41:44 +08:00 committed by GitHub
parent bb21a206a9
commit bbc3eaaa4d
1 changed files with 2 additions and 1 deletions

View File

@ -1597,6 +1597,7 @@ void PhysicsSetGravityEnableTest::onEnter()
// common box // common box
auto commonBox = makeBox(Vec2(100, 100), Size(50, 50), 1); auto commonBox = makeBox(Vec2(100, 100), Size(50, 50), 1);
commonBox->getPhysicsBody()->setTag(DRAG_BODYS_TAG); commonBox->getPhysicsBody()->setTag(DRAG_BODYS_TAG);
commonBox->getPhysicsBody()->setGravityEnable(true);
addChild(commonBox); addChild(commonBox);
auto box = makeBox(Vec2(200, 100), Size(50, 50), 2); auto box = makeBox(Vec2(200, 100), Size(50, 50), 2);
@ -1622,7 +1623,7 @@ void PhysicsSetGravityEnableTest::onScheduleOnce(float /*delta*/)
auto ball = getChildByTag(2); auto ball = getChildByTag(2);
ball->getPhysicsBody()->setMass(200); ball->getPhysicsBody()->setMass(200);
_physicsWorld->setGravity(Vec2(0, 98)); _physicsWorld->setGravity(Vec2(0, -98));
} }
std::string PhysicsSetGravityEnableTest::title() const std::string PhysicsSetGravityEnableTest::title() const