i have auto player (Computer ) in my bike race game. whenever some hard objects is there like traffic light, road blocker, speed braker. it nee dto jump automatically.
For that , in poarticular object class am checking which fixture is colliding with the object. if it matches with my Auto player body. then am giving jump command.
so jump is not smoothly . because after collided its jumping. i need to jump before the object reaches so jump will look good on screen.
For that how to do in cocos2dx box2d ?
My jump code in road block class
bool Block::HandleBeginContact(b2Fixture *fixtureA,b2Fixture *fixtureB)
{
b2Body *bodyA = fixtureA->GetBody();
b2Body *bodyB = fixtureB->GetBody();
b2Fixture *myFixture = RoadBlock->GetFixtureList(); //am getting all list from Road block body
if(myFixture == fixtureA || myFixture == fixtureB)
{
//am collided with Road block
if(bodyB == AIRider::g_MainBody || bodyA == AIRider::g_MainBody )
{
AIBike::Direction.y = 50.0f;
}
}
}