Question

I am trying to do flappy bird like game in andengine. I achieved everything and everything worked out but the rotation is not working. setangularvelocity is not working

my code is as follows

onscenetouch I am giving linear velocity as follows

body.setLinearVelocity(new Vector2(2, 2)); 
 float omegaFactor = (float) -1.0;
 body.setAngularVelocity((float) ( (Math.PI) * omegaFactor) ); 

please suggest me what I am doing wrong.

Was it helpful?

Solution

The physics connector has a boolean paramter which states the update of body rotation.

Unfortunately it was false in my game. I changed it to true and it worked.

physicsWorld.registerPhysicsConnector(new PhysicsConnector(levelObject, body, true, false));

to

physicsWorld.registerPhysicsConnector(new PhysicsConnector(levelObject, body, true, true));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top