how to scale a sphere
Blitz3D Forums/Blitz3D Beginners Area/how to scale a sphere
| ||
to looks like a basketball impact (hit the ground) all my sin / cos code deforms the sphere and i get an ugly egg. i mean i need a glibber code ;) what looks like God-feeds . www.marions-kochbuch.de/index-bilder/goetterspeise.jpg no idea to get a good looking ball |
| ||
you mean you want a wobbling mesh? I guess you need to rig the mesh and then apply physics to every vertex. you could do something like: check the direction the force/pressure is coming from. This is usually where the ball comes from. on impact make a list of all vertices, sorted by distance to the force. Depending on the weight of the ball and the material (rubber? götterspeise? doug hafenen belly?) you may squeeze the vertices more or less. The "higher" they are, the more they will be moved toward the level of impact. This effect is only temporary and should be performed in a morphing method. The same way you sqeeze the ball, you should also be able to stretch the ball, so you can add some kind of fading echo that's gonna make it wobble the real way (squeeze>stretch>squeeze>stretch...). |
| ||
yap i mean a wobbling mesh , but apply phys to every vertex is moore as i need i need a other way it is a minigame u know ... |
| ||
Something really simple:Graphics3D 640,480,32,2 SetBuffer BackBuffer() s=CreateSphere() EntityFX s,16 Global wob#=0,wob_sin,wob_step# cam=CreateCamera() TranslateEntity cam,0,1,-5 WireFrame 1 While KeyDown(1)=0 If KeyHit(57) pushmesh(.212,180,20) EndIf If wob>0 wobblemesh(s) EndIf RenderWorld Flip Wend End Function pushmesh(ww#,wsi#,wst#) wob=ww wob_sin=wsi wob_step=wst End Function Function wobblemesh(m) amount#=Sin(wob_sin)*wob ScaleEntity m,1.0-amount/2.0,1.0+amount,1.0-amount/2.0 wob=wob*.98 wob_sin=wob_sin+wob_step wob_step=wob_step*1.02 If wob<0.05 Then wob=0 End Function |
| ||
thx ;) |