CreatePivot.htm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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>CreatePivot ( [parent] )</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. parent (optional) - parent entity of pivot
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Creates a pivot entity. <br />
  21. <br />
  22. A pivot entity is an invisible point in 3D space that's main use is to act as a parent entity to other entities. The pivot can then be used to control lots of entities at once, or act as new centre of rotation for other entities. <br />
  23. <br />
  24. To enforce this relationship; use EntityParent or make use of the optional parent entity parameter available with all entity load/creation commands. <br />
  25. <br />
  26. Indeed, this parameter is also available with the CreatePivot command if you wish for the pivot to have a parent entity itself.
  27. </td>
  28. </tr>
  29. </table>
  30. <h1><a href=../3d_examples/CreatePivot.bb>Example</a></h1>
  31. <table>
  32. <tr>
  33. <td>
  34. ; CreatePivot Example <br />
  35. ; ------------------- <br />
  36. <br />
  37. Graphics3D 640,480 <br />
  38. SetBuffer BackBuffer() <br />
  39. <br />
  40. camera=CreateCamera() <br />
  41. PositionEntity camera,0,0,-10 <br />
  42. <br />
  43. light=CreateLight() <br />
  44. RotateEntity light,90,0,0 <br />
  45. <br />
  46. ; Create pivot. This is invisible. <br />
  47. pivot=CreatePivot() <br />
  48. <br />
  49. ; Create planet (i.e. a sphere). Make the pivot the parent of the planet. <br />
  50. planet=CreateSphere(16,pivot) <br />
  51. <br />
  52. ; Position planet so that it is offset from the pivot <br />
  53. PositionEntity planet,5,0,0 <br />
  54. <br />
  55. While Not KeyDown(1) <br />
  56. <br />
  57. ; Turn pivot, thus making planet spin around it <br />
  58. TurnEntity pivot,0,1,0 <br />
  59. <br />
  60. RenderWorld <br />
  61. Flip <br />
  62. <br />
  63. Wend <br />
  64. <br />
  65. End
  66. </td>
  67. </tr>
  68. </table>
  69. <br>
  70. <a target=_top href=../index.htm>Index</a><br>
  71. <br>
  72. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=CreatePivot&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  73. </html>