Collision Detection - Need help

Hi Java Coders,

can anybody give me a helping hand regarding Collision Detection?
In comparasion to the java3d Api there seem to be a few (WakeUpOn…) Classes left to handle easy collision detection. BoundingBox and BoundingSphere are already implemented, so collision detection couldn’t be as awkward as it is in Jogl. But I don’t get it.
So it would be nice, if somebody can show me a code fragment or a tut, where I can study it. Or the best case ever, show me an equivalent to the java3d TickTockCollision Demo.

thx in advance

Miguel

You need to add “Haven’t got a frickin clue!” :slight_smile:

Kev

As you have no doubt seen, full Java3D Behaviour support is lacking in Xith3D currently.

Collision detection using a bounding box? I’ll describe one possible method which can be used with two 2D rectangles in pseudo code.


boolean isIntersect(Cube1, Cube2)

// Check four corners of Cube 1
Loop though all 4 corner points of Cube1.
   If point is in Cube2 (simple greater-than/less-than test on the top right and bottom left corners of the cube), then return true (they are intersecting

// Check four corners of Cube 2
Loop though all 4 corner points of Cube2.
   If point is in Cube1, then return true (they are intersecting

// No intersection
return false 

Now just apply that to the 3D coordinate space and you’re on your way :slight_smile:

Cheers,

Will.

In favor of integration of ODE Physics Engine with Xith3D, I was thinking about using OPCODE (collizion detection system) included in this library for some collision detection operations.

I an waiting for approval of odejava project at java.net to start looking for that in more details.

Yuri

Hi All,

thx for your quick replies.
As Kev pointed out right, I have no frickin clue. That’s why I study it :wink: and code samples are very very useful. If somebody knows some post it here! In order to find some I searched the web for examples and luckily found some. A good one can be found there: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=30 and if the jogl port is not working here are the whole port’s for all nehe tuts: http://pepijn.fab4.be/nehe/ It’s not a simple one but a very good one.
Btw I changed back to jogl because the lack of behaviour in xith3d. So I am looking forward to see it or something similar implemented ;D
The other time I tried a little bit around, which you can see it here: http://mitglied.lycos.de/redries/jogl/Kollision.java
It’s not good and finished, but a first try in order to get collision detection with bsp trees :wink:

Happy coding

Miguel

Heh, sorry but I have to chuckle a bit. You don’t have wakeup on collision, so you are going to go down tot he opengl layer and code ray to triangle bsp collision detection? Thats like saying my car doesn’t have anti-lock breaks so I am going to design and build my own car.

Well, the NeHe collision detection really can’t be compared to scene level CD. Its like dropping down into assembly language. If you are willing to do CD at that level then why not just build your BSP on your models in the Xith3D scene and run CD in Xith3D once per frame. Then adjust your transform groups to account for collision? That has to be easier than writing a project at the opengl layer.

Anyway, I should have a first version of an implementation of collision avoidence and detection within a week in Xith3D.