How would I do collision between models?

Started by Andrew_3ds, December 02, 2014, 04:27:53

Previous topic - Next topic

Andrew_3ds

I have tried to read some collision stuff online, but they are in c++ syntax that I don't understand, and they mostly AABB which I don't want because I want to have very precise collision. I was wondering if anyone knew how to do polygon-based collision detection(for 3d .obj models) that is not resource intensive, because I want it to be fast and not somehow be too slow and have somethings clipping through each other.

Zeroni

I really depends on what you mean by model collision. If you are talking about deformable meshes, ridgid bodies, fracturing, etc... I personally use a few AABB to represent one model. Example: If you have a car and you want to make changes to it then maybe have an AABB for each window to check for shattering, front a back fenders, tires, etc. If you want more help then I suggest giving more insight on what you are trying to do.

I don't like recommend things I haven't tried, but I hear that Bullet-Physics Library is good. You can find the Java implementation of it here.
- Zeroni

abcdef

AABB's are important how ever detailed you want to do your collision detection to.

The general way of doing collision is to use two different methods, one after the other

a) Filter out items you definitely know are not going to collide

Do a high level check on all collisionable objects (Normally called broadphase collision detection). This typically uses AABB's.

You are then left with a much reduced list (hopefully).

This type of collision detection is very fast.

b) Find exact collisions

Do a more detailed check on the results that passed a). This is normally called narrowphase collision detection. This type of collision detection is exact but the pay off is the calculation is much slower.

Because b) is slow you want to do it on the least amount of objects as possible and this is what a) helps with.

Check out http://thegeneralsolution.wordpress.com/2011/12/12/collision-detection-broad-phase-vs-narrow-phase/

Andrew_3ds

Can someone show me some code for AABB in java? I don't exactly even know how to do it and apply it to every model and check if they are colliding.

I looked up JBullet, and if someone could show me a good tutorial for Bullet collision in java that would also work.

Zeroni

This is a tutorial on implementing Ray Casting and AABB for collision detection.

This is a tutorial on implementing Bullet Physics Library for collision and simulation.
- Zeroni