Problem with physics only happening in Android devices (Part2) (Solved) – #7 by system – C++


@panor I think autostep is the issue, but it should be turn off after scene is initialized.
I used physics in so many games without any problem.
Try below, i hope this will help you.

// In init() or constructor
this->scheduleOnce(SEL_SCHEDULE(&TerryTowers::updateAutoStep), 0.1f);
...

void TerryTowers::updateAutoStep(float dt)
{
	this->getScene()->getPhysicsWorld()->setAutoStep(false);
	this->schedule(SEL_SCHEDULE(&TerryTowers::updateGame));
}

void TerryTowers::updateGame(float dt) 
{
	this->getScene()->getPhysicsWorld()->step(1.0f / 60.0f);
}



Source link

More To Explore

Share on facebook
Share on twitter
Share on linkedin
Share on email