Collision detection on a bezier curved surface?
I have created a bezier surface and i now need to detect and respond to a sphere colliding along it. Can anyone help???? Do i need to use ray tracing? Or Bound box? And how would i use them to for the detection and responce? I have looked at a few tutorials on Collision detection, but none of descride collision along a curved surface. I am very new to OpenGL programming and have been learning most of my stuff from the Red Book. My bezier surface is created using the following code: GLfloat xpoint = 15.0; GLfloat xcurve = 9.0; GLfloat ymiddle = 0.6; GLfloat ytopbot = 1.5; GLfloat zpoint = 30.0; GLfloat zcurve = 48.0; //Create Points for bezier surface GLfloat ctrlpoints[4][4][3] = { { {-xpoint, -ytopbot, -zpoint}, {-xcurve, -ytopbot, -zcurve}, {xcurve, -ytopbot, -zcurve}, {xpoint, -ytopbot, -zpoint}}, { {-xpoint, -ymiddle, -zpoint}, {-xcurve, -ymiddle, -zcurve}, {xcurve, -ymiddle, -zcurve}, {xpoint, -ymiddle, -zpoint}}, { {-xpoint, ymiddle, -zpoint}, {-xcurve, ymiddle, -zcurve}, {xcurve, ymiddle, -zcurve}, {xpoint, ymiddle, -zpoint}}, { {-xpoint, ytopbot, -zpoint}, {-xcurve, ytopbot, -zcurve}, {xcurve, ytopbot, -zcurve}, {xpoint, ytopbot, -zpoint}} }; GLfloat texpts[2][2][2] = {{{0.0, 0.0}, {0.0, 1.0}}, {{1.0, 0.0}, {1.0, 1.0}}}; drawCurve() { glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &ctrlpoints[0][0][0]); glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, &texpts[0][0][0]); glEnable(GL_MAP2_TEXTURE_COORD_2); glEnable(GL_MAP2_VERTEX_3); glEnable(GL_AUTO_NORMAL); glMapGrid2f(20, 0.0, 1.0, 20, 0.0, 1.0); glEvalMesh2(GL_FILL, 0, 20, 0, 20); }
I think it would be the easiest (and most accurate - but my knowledge in higher mathematics is limited) if you would build your own mesh out of the bezier surface (relatively easy, see NeHe tuts), and then do a bound -> tri&tri test for the triangles on the sphere and on the surface. I can help if needed.
The world isn't unpredictable. It's CHAOTIC.
Cool, thanks for your help.
I am going to implement a mesh this week and see if i can get the collision detection working.
I am going to implement a mesh this week and see if i can get the collision detection working.
if ur curve goes inward like say ur making a ice hocket game then u can simple create the entire bounding walls, u know the egg shape out of planes and do plane collision detection!
if u understand
if u understand
----------------------------http://djoubert.co.uk
or if you like official definitions...
A POINT ON A BÉZIER CURVE (read CURVED SURFACE) ALWAYS LIES WITHIN THE CONVEX HULL OF THE CONTROL POINTS
A POINT ON A BÉZIER CURVE (read CURVED SURFACE) ALWAYS LIES WITHIN THE CONVEX HULL OF THE CONTROL POINTS
The world isn't unpredictable. It's CHAOTIC.
Quote:
Original post by Intamin AG
or if you like official definitions...
A POINT ON A BÉZIER CURVE (read CURVED SURFACE) ALWAYS LIES WITHIN THE CONVEX HULL OF THE CONTROL POINTS
Which doesn't help at all with poly-level collision detection [wink].
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement