Sign in to follow this  
b3rs3rk

Bezier patches and collision

Recommended Posts

Quote:
Original post by Intamin AG
nehe has a simple collision detection tut which covers sphere to cylinder, plane & sphere collisions


i LOVE when someone gives me a VERY USEFUL answer -___-

Share this post


Link to post
Share on other sites
I had encountered a minor error which rendered my ray-triangle test useless which I hadn't manage to spot until now so expect a dlay.. the two day time limit starts over :P

Here is basically what I will do:

Store simple object in model structure (tris with vert pointers and vert list)

Store bezier patch in other model structure

Start off with bezier patch at origin and object couple units above it, with cursor keys and pageup/ pagedown to move it around

Test each triangle of simple object with each triangle in patch in this way:


loop through tris in simple object
{
loop through tris in complex object
{
cola = CheckEdge1;
colb = CheckEdge2;
colc = CheckEdge3;

if(cola || colb || colc)
RenderRedAndPutText;
else
RenderGreen;
}
}


put out text message and render colliding polygons as red (actually intersecting polygons) and others as green

Share this post


Link to post
Share on other sites
Ture Bezier-Patch collision detection is VERY HARD to implement (from the mathematical point of view).
I'd recommend you to do a adaptive collision tesslation. Remember that a bezier patch is allways within the convex hull of the control points. This means that you can make a bounding volumn around your control points and then first to test the collision against this bounding volumn.
Then you tesslate the bezier patch into triangles and do a collision detection against this triangles if a more exact collision detection is needed.

Share this post


Link to post
Share on other sites
I am assuming a low precision "true patch" collision hull in my demo so I sont need to do a bounding volume test..

like I have a 12 pollie box to test against an 16x16x2 (512) or 8x8x2 (128) bezier patch collision hull

I dont really need to optimise to give this guy what he needs but in the end in my engine I wil have spacial partitioning and bounding volume tests in between of course

Share this post


Link to post
Share on other sites
you can easily fake the collision detection by setting weapclip brushes in gtkradiant, q3map will not render them but add node brushes, it looks very realistic when you collide with the "fake node" then. If you want to know more ask me on msn berserk :)

Share this post


Link to post
Share on other sites
he said he has a quake3 like engine, not THE quake3 engine...

I am making my tri-tri tests a bit more accurate, then I'll add the bezier patch... this code is far from optimal but is very accurate

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this