; SpriteViewMode Example ; ---------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() ; The camera hangs from a pivot so it can orbit the sprite pivot=CreatePivot() PositionEntity pivot,0,1,0 camera=CreateCamera(pivot) PositionEntity camera,0,0,10 light=CreateLight() RotateEntity light,90,0,0 ; A reflective floor helps show the camera moving plane=CreatePlane() EntityTexture plane,LoadTexture("media/Chorme-2.BMP") sprite=LoadSprite("media/b3dlogo.jpg") PositionEntity sprite,0,1,0 pitch=-15 yaw=180 roll=0 view_mode=1 view_mode_info$=" (fixed)" While Not KeyDown(1) ; Cursor keys orbit the camera, A and S roll it If KeyDown(208) And pitch<0 Then pitch=pitch+1 If KeyDown(200) And pitch>-89 Then pitch=pitch-1 If KeyDown(205) Then yaw=yaw+1 If KeyDown(203) Then yaw=yaw-1 If KeyDown(30) Then roll=roll+1 If KeyDown(31) Then roll=roll-1 ; Choose a sprite view mode with keys 1-4 If KeyHit(2) Then view_mode=1 : view_mode_info$=" (fixed: always faces camera)" If KeyHit(3) Then view_mode=2 : view_mode_info$=" (free: independent of camera)" If KeyHit(4) Then view_mode=3 : view_mode_info$=" (upright1: faces camera, rolls with it)" If KeyHit(5) Then view_mode=4 : view_mode_info$=" (upright2: billboard, stays upright)" ; Apply the view mode to the sprite SpriteViewMode sprite,view_mode RotateEntity pivot,pitch,yaw,0 PointEntity camera,sprite,roll RenderWorld Text 0,0,"Cursor keys: orbit camera A/S: roll camera 1-4: view mode Esc: exit" Text 0,20,"SpriteViewMode sprite,"+view_mode+view_mode_info$ Flip Wend End