Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to accomplish an deforming physic behaviour for levelsurfaces, but don't get an idea how to start with the implemenation so far. Regardless of the shape from the surface (planes, cubes, spheres…), I want to have small indentations at the positions from game-entitys (players, enemys, objects…).

It's kind of complicated to explain, so I illustrated what I'm talking about (here is an example with an sphere):

illustration deforming surface game

So, the surfaces should be able to deforming themselfs a little bit (to apear like an really soft bed or sofa). My surfaces need probably an high vertices count to get an smooth deforming, but my big problem is the math for calculating this deforming…

I'm programming in C/C++ with OpenGL, but will be fine with any advices in the right direction.

Any help would be highly appreciated,

share|improve this question

For a simple deformation, you can pick a point on the surface/object to manipulate, then apply a transformation (e.g. translation) to it. Then, transform all points within a certain distance from that point the same way, but have the transformation loose strength the further away from the chosen point you are.

So, to make stuff indent under a character, choose the point he/she is standing on and displace it downwards.

Depending on what effect you want to archive, you might want to apply the transform globally, locally or towards/away from the object center and/or use different functions to simulate different materials.

A simple example of indenting a plane using sin/cos falloff functions can be found among

share|improve this answer
I get a 403 forbidden error on the link. – George Duckett Nov 21 '11 at 14:44
Well... 'lil hack is in order then (also, directly to the section in question):… – sarahm Nov 21 '11 at 14:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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