6

Is there any OpenGL, OpenGL ES or WebGL code example on the web how 3D Collision Detection can be implemented with Shaders (preferably GLSL)?

Thank you.

1 Answer 1

4

GLGE has shader based collision detection. See this demo. (WASD,spacebar and mouse to move around. Notice how you collide with walls, etc.)

If you look at the source code, collision detection is handled with the code

var ray=gameScene.ray(origin,[0,0,1]);

If you follow this into glge.js you'll see how this is implemented with a special render mode GLGE.RENDER_PICK (which in turn uses a picking fragment shader in pkfragStr).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.