Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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
add comment

1 Answer

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 www.lighthouse3d.com/opengl/terrain/

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

Your Answer

 
discard

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.