home *** CD-ROM | disk | FTP | other *** search
/ TCE Demo 2 / TCE_DEMO_CD2.iso / demo_cd_.2 / mags / stosser / stoser08.arj / stoser08.msa / ISSUE_8 / 32.PNE < prev    next >
Text File  |  1987-04-22  |  2KB  |  65 lines

  1.  
  2. STOS 3-D              Part 5                     Matthew Green
  3.  
  4. Today's lesson is all about ways of programming collisions in STOS
  5. 3-D.  
  6.  
  7. I use two methods of detecting collisions :
  8.  
  9. 1)        Use the TD Zone command that is just like using the zone
  10.            command in normal STOS.
  11.  
  12. 2)        Or you could use the TD Range command for the detection
  13.            of collisions.
  14.  
  15. Any of the two methods above are ok to use.  The second one is best
  16. used with a small amount of objects, because it is very easy to use.
  17.  
  18. We shall tackle the difficult one first.
  19.  
  20. Setting Zones.
  21. --------------
  22.  
  23. You first have to set the zone, remember that the zone if not square like
  24. it is using the normal STOS command. It is a sphere (e.g. football shape)
  25. You can set the zones using a line like :
  26.  
  27. 100 TD SET ZONE n,zone,x,y,z,r
  28.  
  29. n      = the object number
  30. x,y,z = the centre of the zone.(normally the same co-ordinates as the object)
  31. zone = the zone number, 0,1,2,3....up to 20
  32. r       = the radius of the sphere(you can find out there radius of an object
  33. when you are in the O.M)
  34.  
  35. To detect weather two zones have hit each there are two ways of doing it :
  36.  
  37. 200 H=TD COLLIDE(n1,n2)
  38.  
  39. This checks to see if object 1(n1) has hit object 2(n2). if it has then H = n2
  40. other wise H = -1
  41.  
  42. Or you can do this :
  43.  
  44. 200 H=TD COLLIDE(n)
  45.  
  46. This checks to see if any objects have hit object (n) if they have then H= the 
  47. number of the object that hit it. Other wise H = -1
  48.  
  49. The other method of detection which could work well with your program
  50. is if you use the RANGE command. e.g.
  51.  
  52. 100 if td RANGE(n1,n2)<500 then boom : END
  53.  
  54. This checks to see wether object 1(n1) is less than 500 units away from
  55. object2(n2). If it is the program ends. But you could have it do anything.
  56.  
  57. So that is two methods of collision, you should be able to add this to 
  58. your progams to make them even better.
  59.  
  60. Remember if you have any problems you can write to me , my address is in
  61. the contax and i will try and answer you questions.
  62.  
  63. Until next time......
  64.  
  65.