Pitch Problems

Blitz3D Forums/Blitz3D Beginners Area/Pitch Problems

put this code:
    PositionEntity Cam, entityx(Ball), entityy(Ball), entityz(ball)
     RotateEntity Cam, entitypitch(Ball), entityyaw(Ball), 0
     MoveEntity Cam, 0, 0, -10

outside of the main while..wend loop.

If you leave it inside the loop, then the ball rotation affects also the camera position and rotation. Which, I guess, is not exactly what you want..

Anyway, I've made a slight modification to your code, it may inspire you:
Graphics3D 800, 600, 32, 2

Global cam = CreateCamera()
Global ball = CreateSphere(32)
ScaleEntity ball,2,2,2

Global light = CreateLight(3) ;spot light
PositionEntity light,0,5,0
PointEntity light,ball

;let's just create a squared texture
batex = CreateTexture(32,32)
SetBuffer TextureBuffer(batex)
Color 200,25,0
Rect 2,2,30,30
SetBuffer BackBuffer()
EntityTexture ball,batex
ScaleTexture batex,0.1,0.1



SetBuffer BackBuffer()

PositionEntity Cam, EntityX(Ball), EntityY(Ball), EntityZ(ball)
RotateEntity Cam, EntityPitch(Ball), EntityYaw(Ball), 0
MoveEntity Cam, 0, 0, -10

While Not KeyHit(1)


     If KeyDown(200) Then
          TurnEntity Ball, 1, 0, 0

     ElseIf KeyDown(208) Then
          TurnEntity Ball, -1, 0, 0
     EndIf

     UpdateWorld: RenderWorld
     
     Flip: Cls
Wend:End


Sergio.