EntityRadius.bb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ; EntityRadius Example
  2. ; --------------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. light=CreateLight()
  7. sphere=CreateSphere( 32 )
  8. PositionEntity sphere,-2,0,5
  9. cone=CreateCone( 32 )
  10. EntityType cone,type_cone
  11. PositionEntity cone,2,0,5
  12. ; Set collision type values
  13. type_sphere=1
  14. type_cone=2
  15. ; Set sphere radius value
  16. sphere_radius#=1
  17. ; Set sphere and cone entity types
  18. EntityType sphere,type_sphere
  19. EntityType cone,type_cone
  20. ; Enable collisions between type_sphere and type_cone, with ellipsoid->polygon method and slide response
  21. Collisions type_sphere,type_cone,2,2
  22. While Not KeyDown( 1 )
  23. x#=0
  24. y#=0
  25. z#=0
  26. If KeyDown( 203 )=True Then x#=-0.1
  27. If KeyDown( 205 )=True Then x#=0.1
  28. If KeyDown( 208 )=True Then y#=-0.1
  29. If KeyDown( 200 )=True Then y#=0.1
  30. If KeyDown( 44 )=True Then z#=-0.1
  31. If KeyDown( 30 )=True Then z#=0.1
  32. MoveEntity sphere,x#,y#,z#
  33. ; If square brackets keys pressed then change sphere radius value
  34. If KeyDown( 26 )=True Then sphere_radius#=sphere_radius#-0.1
  35. If KeyDown( 27 )=True Then sphere_radius#=sphere_radius#+0.1
  36. ; Set entity radius of sphere
  37. EntityRadius sphere,sphere_radius#
  38. ; Perform collision checking
  39. UpdateWorld
  40. RenderWorld
  41. Text 0,0,"Use cursor/A/Z keys to move sphere"
  42. Text 0,20,"Press [ or ] to change EntityRadius radius_x# value"
  43. Text 0,40,"EntityRadius sphere,"+sphere_radius
  44. Flip
  45. Wend
  46. End