Set collision layers on a object with onCollide?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Re: Set collision layers on a object with onCollide?

Postby pnvv » Sat Jun 13, 2015 1:23 am

Use collideSet. If you look you can find it in the script menu. But here's the tricky thing. As it uses numbers, they don't go like 1, 2, 3, 4, 5... ect. You basically multiply the lowest number by 2 to get the next highest collideset. So, collideset A is 1, B is 2, C is 4, D is 8, and so on. So, if you need collideset F, just find out what number E has (16 btw) and multiply it by 2, and you get 32 which is what you'll need! Also, if you want to spawn an object that collides with nothing, just use collideset = 0. And if you want selfcollision, put heterocollide = true/false. And if you don't want it to collide with water, put collidewater = false. If you want to spawn an object with multiple collision layers, just take the numbers of the individual collidesets and add them up. So, if you want to spawn an object with collision layers A and B, just take 1 + 2 = 3, and put that. I hope that helped, I'm not very good at explaining Thyme.... :lol:
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America

Re: Set collision layers on a object with onCollide?

Postby FRA32 » Mon Jul 27, 2015 2:40 pm

You do it similar to setting the collideset inside the shape itself, just this time using the variable instead of an editing text field:
collideset := <value>
the value of the collideset equals:

1(A) + 2(B) + 4(C) + 8(D) + 16(E) + 32(F) + 64(G) + 128(H)

Depending on what collision layers are selected, add their numeric value to the total. so collideset A B C would be 7, B D H would be 138
FRA32
 
Posts: 229
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron