I am working on my own "novelty" game-engine project, where the world is represented by a continuous density function. It has only one interface, a function that returns the density at a given point:

float sample(float x,float y,float z);

I triangulate this density into an iso-surface for density == 1.0 using marching cubes. The iso-surface is then rendered using OpenGL to display the result on screen.

I have made a function using newton's method to approximate the nearest point in the volume with density equal to 1 (within an error margin) for a certain direction, like this:

vec3d hitTest(vec3d &origin, vec3d &direction);

I can use this to perform collision detection between my main character and the volume, by seeing if the character has transitioned from "outside" to "inside" of the volume during update. I am also able to find the normal at the hit point by doing 3 hit-tests and doing some simple vector math "(a-b).crossProduct(a-c)" or some such.


How would I be able to calculate the proper collision response?

I am no expert in collision detection/response, so what I am after is a clear and consise explanation of what makes a "physically correct" impulse collision under my foretold circumstances.

Source code in pseudo/C++ is a big bonus!


  • \$\begingroup\$ I forget to mention, by "main character" i mean a single 3d point. I will have to elaborate my character further, but right now a single point is good enough! \$\endgroup\$ – Lennart Rolland Mar 5 '13 at 11:06

Common physics engines only need collisions defined by:

  • the position of the point of contact
  • the surface normal
  • the position/velocity of the moving body (managed b the engine itself)

Therefore, you should be able to use a stock physics engine, as long as it supports plugging in custom collision shapes. I recommend doing so, as it gets you a lot of flexibility to add more interesting physics.

  • \$\begingroup\$ I'll definitely have a look at existing alternatives. But I have added constraints on the projects that need to be considered. For one, it is possible that I cannot rely on floating point because of the "lock-step" nature of my game. If there is a good C++ templated physics engine then that would be awesome (i'd just plug in my own fixed type). Thanks! \$\endgroup\$ – Lennart Rolland Mar 6 '13 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.