ClearCollisions.htm 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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>ClearCollisions</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. None.
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Clears the collision information list. <br />
  21. <br />
  22. Whenever you use the Collisions command to enable collisions between two different entity types, information is added to the collision list. This command clears that list, so that no collisions will be detected until the Collisions command is used again. <br />
  23. <br />
  24. The command will not clear entity collision information. For example, entity radius, type etc.
  25. </td>
  26. </tr>
  27. </table>
  28. <h1><a href=../3d_examples/ClearCollisions.bb>Example</a></h1>
  29. <table>
  30. <tr>
  31. <td>
  32. ; ClearCollisions Example <br />
  33. ; ----------------------- <br />
  34. <br />
  35. Graphics3D 640,480 <br />
  36. SetBuffer BackBuffer() <br />
  37. <br />
  38. camera=CreateCamera() <br />
  39. light=CreateLight() <br />
  40. <br />
  41. sphere=CreateSphere( 32 ) <br />
  42. PositionEntity sphere,-2,0,5 <br />
  43. <br />
  44. cone=CreateCone( 32 ) <br />
  45. EntityType cone,type_cone <br />
  46. PositionEntity cone,2,0,5 <br />
  47. <br />
  48. ; Set collision type values <br />
  49. type_sphere=1 <br />
  50. type_cone=2 <br />
  51. <br />
  52. ; Set up sphere collision data <br />
  53. EntityRadius sphere,1 <br />
  54. EntityType sphere,type_sphere <br />
  55. <br />
  56. ; Set up cone collision data <br />
  57. EntityType cone,type_cone <br />
  58. <br />
  59. ; Enable collisions between type_sphere and type_cone, with sphere->polygon method and slide response <br />
  60. Collisions type_sphere,type_cone,2,2 <br />
  61. <br />
  62. While Not KeyDown( 1 ) <br />
  63. <br />
  64. x#=0 <br />
  65. y#=0 <br />
  66. z#=0 <br />
  67. <br />
  68. If KeyDown( 203 )=True Then x#=-0.1 <br />
  69. If KeyDown( 205 )=True Then x#=0.1 <br />
  70. If KeyDown( 208 )=True Then y#=-0.1 <br />
  71. If KeyDown( 200 )=True Then y#=0.1 <br />
  72. If KeyDown( 44 )=True Then z#=-0.1 <br />
  73. If KeyDown( 30 )=True Then z#=0.1 <br />
  74. <br />
  75. MoveEntity sphere,x#,y#,z# <br />
  76. <br />
  77. ; If spacebar pressed then clear collisions <br />
  78. If KeyHit( 57 )=True Then ClearCollisions <br />
  79. <br />
  80. ; Perform collision checking <br />
  81. UpdateWorld <br />
  82. <br />
  83. RenderWorld <br />
  84. <br />
  85. Text 0,0,"Use cursor/A/Z keys to move sphere" <br />
  86. Text 0,20,"Press spacebar to use ClearCollisions command" <br />
  87. <br />
  88. Flip <br />
  89. <br />
  90. Wend <br />
  91. <br />
  92. End
  93. </td>
  94. </tr>
  95. </table>
  96. <br>
  97. <a target=_top href=../index.htm>Index</a><br>
  98. <br>
  99. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=ClearCollisions&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  100. </html>