1.bodytype.staticbody
2.bodytype.dynamicbody
3.bodytype.kinematicbody
The first static body does not move and does not collide with other body, not affected by gravity
The second dynamic body movement, will collide with other body, there will be a corresponding response after the collision, will be affected by gravity
The third kinematics body will not collide with other body, not affected by gravity.
For example: Dynamicbody and other body such as staticbody (wall, etc.) collide, dynamicbody may rebound, movement direction change and so on,
Kinematicbody give her a speed she will exercise, but when the movement passes through the other body, he will not have the same effect as dynamicbody, but through it
Fixturedef boxbodyfixturedef =physicsfactory.createfixturedef (20f, 0f, 0.5f); FinalRectangle Kinematicrectangle =NewRectangle (600f, 100f,40f, 40f, This. Getvertexbufferobjectmanager ()); Kinematicrectangle.setcolor (0.8f, 0.8f, 0f); Mscene.attachchild (Kinematicrectangle); FinalBody Kinematicbody =physicsfactory.createboxbody (Mphysicsworld,kinematicrectangle, Bodytype.kinematicbody, BOXBODYFIXTUREDEF); Mphysicsworld.registerphysicsconnector (NewPhysicsconnector (Kinematicrectangle, kinematicbody)); Kinematicbody.setlinearvelocity (2, 0); Kinematicbody.setangularvelocity (0.6f);
Three kinds of body types for box2d