Graphics3D 800, 600 SetBuffer BackBuffer() SeedRnd MilliSecs() Ball = CreateSphere(8) EntityFX Ball, 4 g = CreatePlane() MoveEntity g, 0, -1, 0 tex = CreateTexture(8, 8) SetBuffer TextureBuffer(tex) For x = 0 To 8 For y = 0 To 8 Color Rnd(0, 255), Rnd(0, 255), Rnd(0, 255) Plot x, y Next Next EntityTexture(g, tex) SetBuffer BackBuffer() C = CreateCamera() CameraRange(C, .001, 100) MoveEntity C, 0, 10, -16 V = CreateLight() MoveEntity V, -2, 4, 6 While Not KeyHit(1) If KeyDown(30) vx# = vx - .005 If KeyDown(32) vx# = vx + .005 If KeyDown(17) vz# = vz + .005 If KeyDown(31) vz# = vz - .005 PointEntity C, Ball TranslateEntity Ball, vx, 0, vz rx# = -vx / 1 rxa# = ((rx*180)/5.0) rz# = vz / 1 rza# = ((rz*180)/5.0) TurnEntity Ball, rza, 0, rxa, 1 RotateEntity C, EntityPitch(C), EntityYaw(C), 1 RenderWorld() Flip() Wend
Heres a start, I'm using the velocity of the ball as the arc length, and the balls radius to get a angular displacement(which we have to convert from radians to degrees as I've done here).
This should technically work perfectly in a more advanced implementation. I just have to figure out how to add movement in the y axis, as it effects the rotation on the z and x axis as well.