TurnEntity.bb 785 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ; TurnEntity 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. ; Reset turn values - otherwise, the cone will not stop turning!
  11. pitch#=0
  12. yaw#=0
  13. roll#=0
  14. ; Change movement values depending on the key pressed
  15. If KeyDown( 208 )=True Then pitch#=-1
  16. If KeyDown( 200 )=True Then pitch#=1
  17. If KeyDown( 203 )=True Then yaw#=-1
  18. If KeyDown( 205 )=True Then yaw#=1
  19. If KeyDown( 45 )=True Then roll#=-1
  20. If KeyDown( 44 )=True Then roll#=1
  21. ; Move sphere using movement values
  22. TurnEntity cone,pitch#,yaw#,roll#
  23. RenderWorld
  24. Text 0,0,"Use cursor/Z/X keys to turn cone"
  25. Text 0,20,"Pitch: "+pitch#
  26. Text 0,40,"Yaw: "+yaw#
  27. Text 0,60,"Roll: "+roll#
  28. Flip
  29. Wend
  30. End