B3D's Entity Rotation

Blitz3D Forums/Blitz3D Programming/B3D's Entity Rotation

@ sinu ...

Completely disagree. Try this short example ... A + S to rotate the camera, cursors to move. No need to worry about the rotation system ;)


Graphics3D 640,480,16,1

Global LIGHT = CreateLight()
Global PLANE = CreatePlane() 
EntityColor PLANE, 200,100,100
texture = CreateTexture( 32, 32 )
SetBuffer TextureBuffer( texture )
For y = 0 To 1
	For x = 0 To 1
		Color 100, 150+25*( ( x+y) Mod 2 ) , 100
		Rect x*16,y*16,16,16,1
	Next
Next
SetBuffer BackBuffer()
ScaleTexture texture, 50,50
EntityTexture PLANE, texture
FreeTexture texture

Global CUBE = CreateCube() : FitMesh CUBE, -2,0,-2,4,10,4
Global CAMERApivot = CreatePivot()
Global CAMERA = CreateCamera( CAMERApivot )
PositionEntity CAMERA, 0,50,-50
PointEntity CAMERA , CAMERApivot

While Not KeyDown(1)

	PositionEntity CAMERApivot , EntityX( cube ) , 0, EntityZ( cube )
	TurnEntity CAMERApivot, 0 , KeyDown(31) - KeyDown(30) , 0
	Mx# = KeyDown(205) - KeyDown(203)
	Mz# = KeyDown(200) - KeyDown(208 )
	TFormVector Mx, 0, Mz , CAMERApivot , 0
	TranslateEntity CUBE, TFormedX(), 0, TFormedZ()

	RenderWorld()
	Flip

Wend


Stevie