RotateEntity.bb 746 B

12345678910111213141516171819202122232425262728293031323334353637
  1. ; RotateEntity Example
  2. ; --------------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. light=CreateLight()
  7. cone=CreateCone( 32 )
  8. PositionEntity cone,0,0,5
  9. While Not KeyDown( 1 )
  10. ; Change rotation values depending on the key pressed
  11. If KeyDown( 208 )=True Then pitch#=pitch#-1
  12. If KeyDown( 200 )=True Then pitch#=pitch#+1
  13. If KeyDown( 203 )=True Then yaw#=yaw#-1
  14. If KeyDown( 205 )=True Then yaw#=yaw#+1
  15. If KeyDown( 45 )=True Then roll#=roll#-1
  16. If KeyDown( 44 )=True Then roll#=roll#+1
  17. ; Rotate cone using rotation values
  18. RotateEntity cone,pitch#,yaw#,roll#
  19. RenderWorld
  20. Text 0,0,"Use cursor/Z/X keys to change cone rotation"
  21. Text 0,20,"Pitch: "+pitch#
  22. Text 0,40,"Yaw : "+yaw#
  23. Text 0,60,"Roll : "+roll#
  24. Flip
  25. Wend
  26. End