Peristalis / Wobble Model Effect

Blitz3D Forums/Blitz3D Programming/Peristalis / Wobble Model Effect

Here's my feeble attempt at trying to recreate a popular demo effect, where objects twist around on an axis. I know the effect as a Peristalis Effect.

I wondered if you could help me make it a proper peristalis effect. As allthough it doesnt look too bad, it does lack in smoothness and the movement is all screwy. And to be honest, I don't quite know how to address it too well. And please use your own media, as Im unable to host at present.

Here's the routine that I'd appreciate any help with:

;peristalis effect :WIP
;by Mikey F

Const xres=640,yres=480
Graphics3D xres,yres,32
SetBuffer BackBuffer()

cam=CreateCamera()
PositionEntity cam,0,0,-25

lit=CreateLight()
AmbientLight 000,000,000

Global cntsurf,surf

Global UpdateX#
Global UpdateY#
Global UpdateZ#

Global angle1#,angle2#
Global angle3#,angle4#
Global angle5#,angle6#
Global counter

Global aa1#,aa2#,aa3#,aa4#,aa5#,aa6#


;-==========================================================-
;-=[load and make / store vertex and triangles etc        ]=-
;-=[in order to manipulate each face, that's the theory ;)]=-
;-==========================================================-

Global copymodel	=LoadMesh	("media\yourmodel.3ds")
Global surf1		=GetSurface	(copymodel,1)

Global effectmod	=CreateMesh()
Global surf2		=CreateSurface(effectmod)

Global amount1		=CountVertices	(surf1)
Global amount2		=CountTriangles	(surf1)

Dim vrt(amount1,3),vrtx#(amount1),vrty#(amount1),vrtz#(amount1)
Dim tri(amount2)


For count=0 To CountVertices(surf1)-1

	AddVertex(surf2,VertexX(surf1,count),VertexY(surf1,count),VertexZ(surf1,count))

 	VertexNormal surf2,count, VertexNX( surf1, count), VertexNY( surf1, count), VertexNZ( surf1, count )

	vrtx(count)=VertexX#(surf2,count)
	vrty(count)=VertexY#(surf2,count)
	vrtz(count)=VertexZ#(surf2,count)

	vertices=count

Next

For count=0 To CountTriangles(surf1)-1

	tri(count)=AddTriangle(surf2,TriangleVertex(surf1,count,0),TriangleVertex(surf1,count,1),TriangleVertex(surf1,count,2))
	triangles=count

Next

FreeEntity 		copymodel

texture			=LoadTexture("media\texture.png",512)

ScaleEntity 	effectmod,.1,.1,.1
;EntityShininess effectmod,.5
PositionEntity 	effectmod,0,0,10
EntityFX 		effectmod,16
EntityTexture	effectmod,texture

;-=============-
;-=[Main Loop]=-
;-=============-
While Not KeyHit(1)
Cls
	
	wobble_wobble()
	
	RotateEntity effectmod,xr#,yr#,zr#
	
	xr#=xr#+.3
	yr#=yr#+.5
	zr#=zr#+.4

	RenderWorld()
	UpdateWorld()
	
Flip
Wend
FreeEntity effectmod


Function wobble_wobble()

cntsurf	=CountSurfaces	(effectmod)
surf	=GetSurface	(effectmod,cntsurf)

aa1=angle1
aa2=angle2

aa3=angle3
aa4=angle4

aa5=angle5
aa6=angle6

For count=0 To amount1-1
	
	x#=vrtx#(count)
	y#=vrty#(count)
	z#=vrtz#(count)

	counter=count ;comment this for different movement :)

	UpdateX=Sin(aa1+counter)*4;+Cos(aa2+counter)*12
	UpdateY=Cos(aa3+counter)*3;+Cos(aa4+counter)*32
	
	UpdateZ=Sin(aa5+counter)*12;+Cos(aa6+counter)*14

    VertexCoords surf,count,x#+UpdateX,y#+UpdateY,z#+UpdateZ

Next

angle1 = angle1 +2	
angle2 = angle2 -4
;-
angle3 = angle3 +3
amgle4 = angle4 +2
;-
angle5 = angle5 -2
angle6 = angle6 +1

If angle1>359 Then angle1=000
If angle2<000 Then angle2=359
;--
If angle3>359 Then angle3=000
If angle4>359 Then angle4=000
;--
If angle5<000 Then angle5=359
If angle6>359 Then angle6=000

End Function