I am developing an Android game using the libgdx box2d library in Eclipse. But I am stuck on a problem. I want to drop a static body whenever the the moving ball touches that static body (a polygon shape box), the method is called in the ContactListener.beginContact()
.
I tried to create a new body with the same properties but the body type changed to dynamicbody. But if I do this, I am getting NullPointerException
every time the ball touches the static body. Also getting a NullPointerException
when tried to setLinearVelocity(0)
on a kinematicbody.
How can I implement this?