Archived

This topic is now archived and is closed to further replies.

HALx

Ball deformation ( Help me)

Recommended Posts

I must make a ball that it bounces and that is become deformed when touches the floor. In order to bounce with the gravity I do not have problems, but for the deformation I do not know what to make. Someone can help me? Thanks.

Share this post


Link to post
Share on other sites
One way would be to 1st code your own sphere routine using loops and sin/cos, generally a valuable thing to do anyway. I have a routine called solid_sphere(size,slices,stacks); that draws a sphere around 0,0,0, (I can place it anywhere in any orientation beforehand) It also handles textures and normals.

Then the routine could be modified slightly to test each generated vertex against a plane/floor and clamp the vertex appropriately. This sphere remains round but flattens at the contact locations.

If you want a ball that simply compresses/squishes, you could compute how much to compress it based upon position/proximity to the surface, and use scale to shrink the y scale (and inversely stretch x & z!) in concert w/ downward movement and reducing velocity.

Or, and I believe the proper way, is to do a spring simulation type thing, where the sphere is constructed by springs arranged spherically, then it should behave with both flattening and compression effects.

But that''s alot of work!

zin

zintel.com - 3d graphics & more or less

Share this post


Link to post
Share on other sites