Why does the cube discontinue rotation?

Blitz3D Forums/Blitz3D Beginners Area/Why does the cube discontinue rotation?

Captain Wicker (crazy hillbilly)(Posted 2011) [#1]
Graphics3D 800,600,32,3
SetBuffer BackBuffer()
cam1=CreateCamera()
l1=CreateLight(2)
PointEntity l1,cam1

Global cube=CreateCube()
PositionEntity cube,0,0,5

While Not KeyHit(1)
	
	;Rotate()  ;Not using this
	
	While KeyDown(57)
		RotateEntity cube,0,0,5
	Wend
	
	UpdateWorld
	RenderWorld
	Flip
Wend




Function Rotate%()
	If KeyDown(57) Then RotateEntity cube,0,0,1
End Function

? :(


Floyd(Posted 2011) [#2]
RotateEntity doesn't mean what you think it does. You want TurnEntity.
The distinction is analogous to PositionEntity versus MoveEntity.

Also note that no matter how much you spin the cube you won't actually see anything until you release the space bar ( key 57 ).


Captain Wicker (crazy hillbilly)(Posted 2011) [#3]
Also note that no matter how much you spin the cube you won't actually see anything until you release the space bar ( key 57 ).

Should I use KeyHit() instead? Thanks Floyd! :)

EDIT: Fixed my own problem. sorry.
Graphics3D 800,600,32,3
SetBuffer BackBuffer()
cam1=CreateCamera()
l1=CreateLight(2)
PointEntity l1,cam1

Global cube=CreateCube()
PositionEntity cube,0,0,5

While Not KeyHit(1)
	
	Rotate()
	
	
	UpdateWorld
	RenderWorld
	Flip
Wend




Function Rotate%()
	If KeyDown(57) Then TurnEntity cube,0,0,1
End Function


Last edited 2011