This is one way to do it but it only works on a flat board.
You need a texture (texture.jpg) to see the ball rotate.
What I do below is make a pivot (visualized in the example)
and move it accordingly to the degrees of the balls orientation,
then I just point the ball at the pivot and turn the ball.
It's kinda cheating but it works well :)
You need a texture (texture.jpg) to see the ball rotate.
What I do below is make a pivot (visualized in the example)
and move it accordingly to the degrees of the balls orientation,
then I just point the ball at the pivot and turn the ball.
It's kinda cheating but it works well :)
Graphics3D 640,480,16,2 Global camera = CreateCamera() Global camzoom#=10.0 CameraZoom camera,camzoom# CameraRange camera,1,(400 * camzoom#)+4000 PositionEntity camera,0,0,-500 sphere=CreateSphere(15) texture=LoadTexture("texture.jpg") EntityTexture sphere,texture PositionEntity sphere,0,0,500 RotateEntity sphere,0,0,0 ScaleEntity sphere,15,15,15 pivot=CopyEntity(sphere) ScaleEntity pivot,5,5,5 WireFrame 0:HidePointer SetBuffer BackBuffer() While Not KeyDown(1) pivx=(MouseX()-320)/3:pivy=(240-MouseY())/3 PositionEntity pivot,pivx,pivy,500 PointEntity sphere,pivot,0 If pivx < 0 Then TurnEntity sphere,180,180,0 If pivx=0 And pivy>0 Then TurnEntity sphere,0,0,90 If pivx=0 And pivy<0 Then TurnEntity sphere,0,0,270 TurnEntity sphere,0,0,z z=z+5:z=z Mod 360 RenderWorld Color 255,255,255 Text 10,10,"Rotate z= "+z Text 10,30,"Pivot x= "+pivx Text 10,50,"Pivot y= "+pivy Flip Wend End