Continuous Movement of gun bullet
- by Siddharth
I was using box2d for the movement of the body. When I apply gravity (0,0) the bullet continuously move but when I change gravity to the earth the behavior was changed. I also try to apply continuous force to the bullet body but the behavior was not so good. So please provide any suggestion to continuously move bullet body in earth gravity.
currentVelocity = bulletBody.getLinearVelocity();
if (currentVelocity.len() < speed|| currentVelocity.len() > speed + 0.25f) {
velocityChange = Math.abs(speed - currentVelocity.len());
currentVelocity.set(currentVelocity.x* velocityChange, currentVelocity.y*velocityChange);
bulletBody.applyLinearImpulse(currentVelocity,bulletBody.getWorldCenter());
}
I apply above code for the continuous velocity of the body. And also I did not able to find any setGravityScale method in the library.