Today's lesson is all about ways of programming collisions in STOS3-D.
I use two methods of detecting collisions :
We shall tackle the difficult one first.
100 TD SET ZONE n,zone,x,y,z,r
n = the object number
x,y,z = the centre of the zone.(normally the same co-ordinates as the
object)
zone = the zone number, 0,1,2,3....up to 20
r = the radius of the sphere(you can find out there radius of an objectwhen
you are in the O.M)
To detect weather two zones have hit each there are two ways of doing it :
200 H=TD COLLIDE(n1,n2)
This checks to see if object 1(n1) has hit object 2(n2). if it has then H = n2other wise H = -1
Or you can do this :
200 H=TD COLLIDE(n)
This checks to see if any objects have hit object (n) if they have then H= the number of the object that hit it. Other wise H = -1
100 if td RANGE(n1,n2)<500 then boom : END
This checks to see wether object 1(n1) is less than 500 units away fromobject2(n2). If it is the program ends. But you could have it do anything.
So that is two methods of collision, you should be able to add this to your progams to make them even better.
Remember if you have any problems you can write to me , my address is inthe contax and i will try and answer you questions.
Until next time......