Static Body Collision

Hey,

Im having a problem with collision detection with two physics bodies. I have a physic body that im dragging and a physic body that is not draggable (in one position). Everything is right in the code, but physic bodies some how don't react to collision. Am I right? I then made one of the physic bodies dynamic, once it hit the other physic body the collision worked. Is collision only possible with dynamic and static bodies? Is there any other way to make two static bodies have a collision ?

Thanks for any support.

only on dynamic bodies can collide with all type of bodies
static and kinematic body can only collide with dynamic body

there's no alternate way even

What hgvyas123 said.

Check out the physics API, it explains body types in greater detail.

Peach :)

I am trying to make a type of boundary a zone around an object. You are suppose to drag a physic body, out side of the boundary. You can't drag it inside the boundary. If there is no alternative way to have static body collision how can we do this? Can i do this, or is there a different way of doing it ?

Thanks.

this is from box2d site

b2_staticBody

A static body has does not move under simulation and behaves as if it has infinite mass. Internally, Box2D stores zero for the mass and the inverse mass. Static bodies can be moved manually by the user. A static body has zero velocity. Static bodies do not collide with other static or kinematic bodies.

b2_kinematicBody

A kinematic body moves under simulation according to its velocity. Kinematic bodies do not respond to forces. They can be moved manually by the user, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass, however, Box2D stores zero for the mass and the inverse mass. Kinematic bodies do not collide with other static or kinematic bodies.

b2_dynamicBody

A dynamic body is fully simulated. They can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass. If you try to set the mass of a dynamic body to zero, it will automatically acquire a mass of one kilogram.

Bodies are the backbone for fixtures. Bodies carry fixtures and move them around in the world. Bodies are always rigid bodies in Box2D. That means that two fixtures attached to the same rigid body never move relative to each other.

Fixtures have collision geometry and density. Normally, bodies acquire their mass properties from the fixtures. However, you can override the mass properties after a body is constructed. This is discussed below.

You usually keep pointers to all the bodies you create. This way you can query the body positions to update the positions of your graphical entities. You should also keep body pointers so you can destroy them when you are done with them.

reference link ( from where i had copy and paste above):-
http://box2d.org/manual.html#_Toc258082973

views:1799 update:2011/9/29 9:22:17
corona forums © 2003-2011