Scaling for idiots

Blitz3D Forums/Blitz3D Programming/Scaling for idiots

Here's some more. Move the move up and down to scale. Some weird happening here though. But, the general idea is there :D Only way to really solve it, is to you scalemesh, instead of ScaleEntity. It does mean though, that you'll have no way to get back to the orginal scale of the entity. Anyway, here goes:

Graphics3D 800,600
SetBuffer BackBuffer()


Global camera = CreateCamera()
PositionEntity camera,0,0,-10

Global light = CreateLight()

Global cube = CreateCube()

Global mouse_dif#


While Not KeyHit(1)


	If MouseY() <300 Then
		mouse_dif = mouse_dif + 0.1
	ElseIf MouseY()>300 Then
		mouse_dif = mouse_dif - 0.1
	End If
	
	Scale_Mesh(cube, mouse_dif)
	MoveMouse 400,300
	
	UpdateWorld
	RenderWorld
	Flip
Wend
End



Function Scale_Mesh(mesh,scale#)

	If scale < 0 Then
		DebugLog (1.0/Abs(scale))
		ScaleEntity mesh,1.0/Abs(scale),1.0/Abs(scale),1.0/Abs(scale)
	Else
		DebugLog scale
		ScaleEntity mesh,scale,scale,scale
	End If

End Function