RotateMesh.bb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ; RotateMesh Example
  2. ; ------------------
  3. ; In this example we will demonstrate the use of the RotateMesh command.
  4. ; Unlike RotateEntity, RotateMesh actually modifies the actual mesh structure.
  5. ; So whereas using RotateEntity 0,45,0 would only rotate an entity by 45 degrees the first time it was
  6. ; used, RotateMesh 0,45,0 will rotate the mesh every time it is used.
  7. ; This is because RotateEntity rotates an entity based on a fixed mesh structure, whereas RotateMesh
  8. ; actually modifies the mesh structure itself.
  9. Graphics3D 640,480
  10. SetBuffer BackBuffer()
  11. camera=CreateCamera()
  12. light=CreateLight()
  13. ; Rotate light to give better lighting of cube
  14. RotateEntity light,60,30,0
  15. ; Create cube mesh
  16. cube=CreateCube()
  17. ; Position cube in front of camera so we can see it
  18. PositionEntity cube,0,0,5
  19. While Not KeyDown(1)
  20. ; If space bar pressed then rotate mesh by 45 degrees on the y axis. Also set syntax$ text.
  21. If KeyHit(57)=True Then RotateMesh cube,0,45,0 : syntax$="RotateMesh 0,45,0"
  22. RenderWorld
  23. Text 0,0,"Press space to rotate mesh by 45 degrees on the y axis"
  24. Text 0,20,syntax$
  25. Flip
  26. Wend
  27. End