TurnEntity.htm 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>TurnEntity entity,pitch#,yaw#,roll#,[,global]</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. entity - name of entity to be rotated <br />
  13. pitch# - angle in degrees that entity will be pitched <br />
  14. yaw# - angle in degrees that entity will be yawed <br />
  15. roll# - angle in degrees that entity will be rolled <br />
  16. global (optional) -
  17. </td>
  18. </tr>
  19. </table>
  20. <h1>Description</h1>
  21. <table>
  22. <tr>
  23. <td>
  24. Turns an entity relative to its current orientation. <br />
  25. <br />
  26. Pitch is the same as the x angle of an entity, and is equivalent to tilting forward/backwards. <br />
  27. <br />
  28. Yaw is the same as the y angle of an entity, and is equivalent to turning left/right. <br />
  29. <br />
  30. Roll is the same as the z angle of an entity, and is equivalent to tilting left/right.
  31. <br>
  32. <br>
  33. See also: <a class=small href=RotateEntity.htm>RotateEntity</a>, <a class=small href=RotateMesh.htm>RotateMesh</a>.
  34. </td>
  35. </tr>
  36. </table>
  37. <h1><a href=../3d_examples/TurnEntity.bb>Example</a></h1>
  38. <table>
  39. <tr>
  40. <td>
  41. ; TurnEntity Example <br />
  42. ; ------------------ <br />
  43. <br />
  44. Graphics3D 640,480 <br />
  45. SetBuffer BackBuffer() <br />
  46. <br />
  47. camera=CreateCamera() <br />
  48. light=CreateLight() <br />
  49. <br />
  50. cone=CreateCone( 32 ) <br />
  51. PositionEntity cone,0,0,5 <br />
  52. <br />
  53. While Not KeyDown( 1 ) <br />
  54. <br />
  55. ; Reset turn values - otherwise, the cone will not stop turning! <br />
  56. pitch#=0 <br />
  57. yaw#=0 <br />
  58. roll#=0 <br />
  59. <br />
  60. ; Change movement values depending on the key pressed <br />
  61. If KeyDown( 208 )=True Then pitch#=-1 <br />
  62. If KeyDown( 200 )=True Then pitch#=1 <br />
  63. If KeyDown( 203 )=True Then yaw#=-1 <br />
  64. If KeyDown( 205 )=True Then yaw#=1 <br />
  65. If KeyDown( 45 )=True Then roll#=-1 <br />
  66. If KeyDown( 44 )=True Then roll#=1 <br />
  67. <br />
  68. ; Move sphere using movement values <br />
  69. TurnEntity cone,pitch#,yaw#,roll# <br />
  70. <br />
  71. RenderWorld <br />
  72. <br />
  73. Text 0,0,"Use cursor/Z/X keys to turn cone" <br />
  74. Text 0,20,"Pitch: "+pitch# <br />
  75. Text 0,40,"Yaw: "+yaw# <br />
  76. Text 0,60,"Roll: "+roll# <br />
  77. <br />
  78. Flip <br />
  79. <br />
  80. Wend <br />
  81. <br />
  82. End
  83. </td>
  84. </tr>
  85. </table>
  86. <br>
  87. <a target=_top href=../index.htm>Index</a><br>
  88. <br>
  89. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=TurnEntity&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  90. </html>