PositionEntity.bb 816 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ; PositionEntity Example
  2. ; ----------------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. light=CreateLight()
  7. cone=CreateCone( 32 )
  8. ; Set position values so that cone is positioned in front of camera, so we can see it to begin with
  9. x#=0
  10. y#=0
  11. z#=10
  12. While Not KeyDown( 1 )
  13. ; Change position values depending on key pressed
  14. If KeyDown( 203 )=True Then x#=x#-0.1
  15. If KeyDown( 205 )=True Then x#=x#+0.1
  16. If KeyDown( 208 )=True Then y#=y#-0.1
  17. If KeyDown( 200 )=True Then y#=y#+0.1
  18. If KeyDown( 44 )=True Then z#=z#-0.1
  19. If KeyDown( 30 )=True Then z#=z#+0.1
  20. ; Position cone using position values
  21. PositionEntity cone,x#,y#,z#
  22. RenderWorld
  23. Text 0,0,"Use cursor/A/Z keys to change cone position"
  24. Text 0,20,"X Position: "+x#
  25. Text 0,40,"Y Position: "+y#
  26. Text 0,60,"Z Position: "+z#
  27. Flip
  28. Wend
  29. End