Strange Collision Detection

Hi,



I've implemented a Collision Detection, which I found in this forum, in my program. But it doesn't work like I expect

Yes that is a probem. I posted that collision code as both something to use, and to demonstrate the problem I was having. At that point in time, I think it was concluded that the issue was a weakness in the triangle collision detection code in jME. I think some work has been done since this, on the OBB stuff, but I never went back and tried it, so it may still be an issue. Are you using a CVS checkout of jME?



Also, here is the thread about the problem.



It only happens (for my case and test) when you are touching more than one object.

Thanks for your reply,



the problem is very strange, because it works when I move the box against a wall or the chairs (and sometimes it works when it moves against the table in the middle of the room). But at the door or the tables on the walls the box starts to shake and gets pushed down through the floor and wall and disappears.

is there a chance to set the z-coordinate of the box (at the collision-detection maybe?) constant to 0, so that the box cannot disappear in the floor? I've tried this but then the collision detection fails completely. Perhaps I did it in the wrong lines. :?

Its not anything you've done wrong in Blender. The problem exists even with the primitive shapes built into jME. What I mean by CVS checkout is, did you download and use the nightly build, or did you use a cvs client to get the latest from the repository?


is there a chance to set the z-coordinate of the box (at the collision-detection maybe?) constant to 0, so that the box cannot disappear in the floor?

What I did is to not use collision detection with the floor. Have your box hover just a little above it (it can't touch it), then the only collisions are the ones when you run into a table or chairs. This may at least reduce the chance to collide with two objects at once, and in the worst case you may go through a table or chair, but not the floor. Do this manual correction of the box bafore calling the collision detection.

I don't really know what else to tell you. I havn't the time to go through my tests right now so I don't know how much help I can be. I hope this helps though.

Maybe someone else here has a different approach?

My Box doesn’t touch the floor all the time. Only when there are more than one objects, which collide with it, it gets pressed through the floor. On the empty wall it works. It’s very very strange… My idea was to avoid that the box changes its z-coordinate (I wanted to make it something like a constant)…maybe it is a stupid idea.



And the CVS…I’ve followed the instuctions on this site http://www.jmonkeyengine.com/wiki/doku.php?id=getting_started. I’m really sorry to give you no concrete answer, because it’s the first time ever, that I have something to do with this.

My idea was to avoid that the box changes its z-coordinate (I wanted to make it something like a constant)...maybe it is a stupid idea.

No, not at all! Thats what I think you need to do. On every update you should cast a ray down from the box and find where it intersects the floor, then you can adjust its height based on the distance to intersection. I think thats the only way to keep it from sliding down through the floor. The collision method I wrote is made to slide, but it goes wacky when colliding with more than one object at the same time because of incorrect results from jME. If the collision results were correct, then this wouldn't be an issue. Maybe in the future. :|
And the CVS....I've followed the instuctions on this site http://www.jmonkeyengine.com/wiki/doku.php?id=getting_started. I'm really sorry to give you no concrete answer, because it's the first time ever, that I have something to do with this.


If you followed this, then you did a checkout from CVS. That means whenever the developers make changes or updates to the code, then you should be able to update your local copy to get them pretty easily. If you're not familiar with CVS you should do some reading about it, its very neat.

Ok thanks a lot. I will follow your hints. (I did a mistake, I mean the y-axis for the height and not the z-axis) :slight_smile: