Entity is at a standstill (no col event sometimes)?

Topics: Developer Forum
Jun 17, 2007 at 7:43 PM
Edited Jun 17, 2007 at 9:16 PM
Wonderful physics engine! I am also one of those people trying to make a platformer using this, but the trouble I have come into is just trying to figure out if my entity is standing on something (so I know they can jump).

I have two RectableRigidBodies, one static, the other not. I have it setup where once a collision is received, it allows me to 'jump'. The problem is, I don't receive the collisions all the time, even though the dynamic object has clearly come to rest on the static object. I do see a little bouncing, so that might be the first problem. I have set the RestitutionCoefficient to 0.

As stated in other posts, I have been tweaking the AllowedPenetration and BiasFactor on the base engine, and several of the members on the rigid bodies. If I set the AllowedPenetration above 0, I don't get a collision event at all,
and setting the BiasFactor to less than 1 also increases the rate of no collision event.

When I get a collision event, I allow the dynamic object to 'jump', which is adding to the verticle linearvelocity of the object. The funny thing here, and maybe another problem, is it starts to rotate while in the air sometime. Is there a way to stop this also?

Jun 18, 2007 at 2:41 AM
Edited Jun 18, 2007 at 2:45 AM
I wanted to add to this. I took the demo5, and put the X directly below the A, and added an event handler to A. It worked great. So, I make the X texture about 4 times wider, and tried it again. It now displays the same behavior I am having. You only get collision events when the object hits the edges, or a corner touches something else. But if two flat sides are touching, the object behaves right, but events are not fired.. I also noticed the A object doesn't get any events when it hits the screen borders either.

Upon further testing, it would seem I don't get an event about 85% of the time. I will be happy to make this modified project available if it would help.
Jun 18, 2007 at 4:36 PM
I'm going to look into collision events a bit more as I work on the new version.

I think you could probably fix what you are seeing by adding more vertices to your objects. Just a guess, though. Sorry I can't be of more help at the moment. I'm at work and my time to dig into this is limited.
Jun 19, 2007 at 1:28 AM
Interesting. I was using a RectabngleRigidBody, and seeing your advice, I switch to a PolygonRigidBody. I only added the four verts just to test, and I get the events now!
Thanks for the suggestion! Again, great library and thanks for answering!!
Jun 19, 2007 at 1:40 AM
Edited Jun 19, 2007 at 1:42 AM
Well, now there is something else weird. Again, I have a small block falling down onto a huge block. I defined both blocks with Polygons consisting of four verts. Now, when sliding the small block to the edge of the big one, it seems the big one has like a crater in it...
Let's say this is the left edge. The star represents the top left vert. The 's' is there to represent space. I can hop the sliding box over the little dip, and fall off the edge, but just sliding along the top, the little object will hang on that little dip. Does this make sense?

__ ssss __________________.
|* | ss_ |
| |ss_ |
Jun 19, 2007 at 8:39 PM
I don't completly follow. Did you read the pdf on the home page of this site. It may give you some insight into how the collision system works and help you debug the problem.

It's really hard to know what's going on without some sort of debug view of the geometry/collision grid. Of course the current version doesn't have any debug views built in so you'd have to create your own.

Jun 20, 2007 at 5:42 AM
Edited Jun 20, 2007 at 1:53 PM
I just did, thanks! The manual mentions a grid size for the simulation? I don't see it in the sim object, has it been taken out? The good news is, I drastically increased the number of verts making my boxes, and that seems to have fixed the problem. Thanks again for the replies!