Peristalis / Wobble Model Effect

Blitz3D Forums/Blitz3D Programming/Peristalis / Wobble Model Effect

Well, if I was you I would solve this problem like this: Make a 2D Program that will wobble a single point.

like

Graphics 640,480,16,2
SetBuffer BackBuffer()


While KeyDown(1)=0
 Cls
 

 If MilliSecs() > tt
  tt=MilliSecs()+100 ; update rubber logic every n MilliSecs
  If MouseHit(1)
   newx#=MouseX()
   newy#=MouseY()
   tensionx#=(newx#-x#)/1.5 ; intial motion detection
   tensiony#=(newy#-y#)/1.5
  EndIf

  oldx#=x
  oldy#=y#
  x#=x#+ tensionx#
  y#=y#+ tensiony#


  If ((x > newx) And (oldx <= newx)) Or ((x < newx) And (oldx >= newx))
   tensionx#=(newx#-x#)/1.1 ; amount of elasticity (near 1.0 = very wobbly)
   tensiony#=(newy#-y#)/1.1
  EndIf
  If ((y > newy) And (oldy <= newy)) Or ((y < newy) And (oldy >= newy))
   tensionx#=(newx#-x#)/1.1
   tensiony#=(newy#-y#)/1.1
  EndIf
 EndIf

 realx#=realx+(x-realx)/5.0 ; smooth rubber chanches
 realy#=realy+(y-realy)/5.0


 Oval realx-5,realy-5,10,10,1
 Text 0,0, "Hit the mouse somewhere"
 Flip
Wend


Now you only have to add a 3rd dimension, and feed the algorithm with all vertices of your mesh. The inital motion detection that is given by a mouseclick in this example needs to be calculated from the previous and new mesh location. Now what I said in the first post: you can modify the wobble value (here 1.1) depending on the distance of the vertices to the center of the mesh. Probably that looks really impressive.