From bbc3eaaa4dcaed4c674f7ee87e075b399f8cced9 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 19 Sep 2017 09:41:44 +0800 Subject: [PATCH] fix gravity direction (#18282) --- tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index b03cd5f3e5..1bbe3e898b 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -1597,6 +1597,7 @@ void PhysicsSetGravityEnableTest::onEnter() // common box auto commonBox = makeBox(Vec2(100, 100), Size(50, 50), 1); commonBox->getPhysicsBody()->setTag(DRAG_BODYS_TAG); + commonBox->getPhysicsBody()->setGravityEnable(true); addChild(commonBox); auto box = makeBox(Vec2(200, 100), Size(50, 50), 2); @@ -1622,7 +1623,7 @@ void PhysicsSetGravityEnableTest::onScheduleOnce(float /*delta*/) auto ball = getChildByTag(2); ball->getPhysicsBody()->setMass(200); - _physicsWorld->setGravity(Vec2(0, 98)); + _physicsWorld->setGravity(Vec2(0, -98)); } std::string PhysicsSetGravityEnableTest::title() const