EntityRadius.htm 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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>EntityRadius entity,x_radius#[,y_radius#]</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. entity - entity handle <br />
  13. x_radius# - x radius of entity's collision ellipsoid <br />
  14. y_radius# (optional) - y radius of entity's collision ellipsoid. If omitted the x_radius# will be used for the y_radius#.
  15. </td>
  16. </tr>
  17. </table>
  18. <h1>Description</h1>
  19. <table>
  20. <tr>
  21. <td>
  22. Sets the radius of an entity's collision ellipsoid. <br />
  23. <br />
  24. An entity radius should be set for all entities involved in ellipsoidal collisions, which is all source entities (as collisions are always ellipsoid-to-something), and whatever destination entities are involved in ellipsoid-to-ellipsoid collisions (collision method No.1).
  25. <br>
  26. <br>
  27. See also: <a class=small href=EntityBox.htm>EntityBox</a>, <a class=small href=Collisions.htm>Collisions</a>, <a class=small href=EntityType.htm>EntityType</a>.
  28. </td>
  29. </tr>
  30. </table>
  31. <h1><a href=../3d_examples/EntityRadius.bb>Example</a></h1>
  32. <table>
  33. <tr>
  34. <td>
  35. ; EntityRadius Example <br />
  36. ; -------------------- <br />
  37. <br />
  38. Graphics3D 640,480 <br />
  39. SetBuffer BackBuffer() <br />
  40. <br />
  41. camera=CreateCamera() <br />
  42. light=CreateLight() <br />
  43. <br />
  44. sphere=CreateSphere( 32 ) <br />
  45. PositionEntity sphere,-2,0,5 <br />
  46. <br />
  47. cone=CreateCone( 32 ) <br />
  48. EntityType cone,type_cone <br />
  49. PositionEntity cone,2,0,5 <br />
  50. <br />
  51. ; Set collision type values <br />
  52. type_sphere=1 <br />
  53. type_cone=2 <br />
  54. <br />
  55. ; Set sphere radius value <br />
  56. sphere_radius#=1 <br />
  57. <br />
  58. ; Set sphere and cone entity types <br />
  59. EntityType sphere,type_sphere <br />
  60. EntityType cone,type_cone <br />
  61. <br />
  62. ; Enable collisions between type_sphere and type_cone, with ellipsoid->polygon method and slide response <br />
  63. Collisions type_sphere,type_cone,2,2 <br />
  64. <br />
  65. While Not KeyDown( 1 ) <br />
  66. <br />
  67. x#=0 <br />
  68. y#=0 <br />
  69. z#=0 <br />
  70. <br />
  71. If KeyDown( 203 )=True Then x#=-0.1 <br />
  72. If KeyDown( 205 )=True Then x#=0.1 <br />
  73. If KeyDown( 208 )=True Then y#=-0.1 <br />
  74. If KeyDown( 200 )=True Then y#=0.1 <br />
  75. If KeyDown( 44 )=True Then z#=-0.1 <br />
  76. If KeyDown( 30 )=True Then z#=0.1 <br />
  77. <br />
  78. MoveEntity sphere,x#,y#,z# <br />
  79. <br />
  80. ; If square brackets keys pressed then change sphere radius value <br />
  81. If KeyDown( 26 )=True Then sphere_radius#=sphere_radius#-0.1 <br />
  82. If KeyDown( 27 )=True Then sphere_radius#=sphere_radius#+0.1 <br />
  83. <br />
  84. ; Set entity radius of sphere <br />
  85. EntityRadius sphere,sphere_radius# <br />
  86. <br />
  87. ; Perform collision checking <br />
  88. UpdateWorld <br />
  89. <br />
  90. RenderWorld <br />
  91. <br />
  92. Text 0,0,"Use cursor/A/Z keys to move sphere" <br />
  93. Text 0,20,"Press [ or ] to change EntityRadius radius_x# value" <br />
  94. Text 0,40,"EntityRadius sphere,"+sphere_radius <br />
  95. <br />
  96. Flip <br />
  97. <br />
  98. Wend <br />
  99. <br />
  100. End
  101. </td>
  102. </tr>
  103. </table>
  104. <br>
  105. <a target=_top href=../index.htm>Index</a><br>
  106. <br>
  107. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=EntityRadius&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  108. </html>