## How do I get all the collision layers to apply to this?

### How do I get all the collision layers to apply to this?

How do I get all the collision layers to apply to a spawned object, like for example, on hit by laser a circle is spawned from a box when the box has a spawn circle script, with laser. Ok, so the real question is how do i get ALL collision layers (A - I) to apply to a spawned object, instead of just collidesets?
By collidesets, i mean this: http://www.phunland.com/forum/viewtopic.php?id=6837 collidesets 1 - 127. thanks guys
decepticon

Posts: 21
Joined: Sat Dec 17, 2016 12:20 pm

### Re: How do I get all the collision layers to apply to this?

each collision layer represents a bit, 3 = bit figures 1 + 2; I'd suggest reading up on binary representation of decimals, probably much easier to understand that way
electronicboy

Posts: 1693
Joined: Mon Aug 31, 2009 6:18 pm

### Re: How do I get all the collision layers to apply to this?

decepticon - I don't know if you got your question answered by now or not, so I will explain it as best as I can.

It appears that you are confused about the difference between "collision layers" and "collideSet". They both refer to the same thing but in different ways. On the Edit panel of any Algodoo object, you can click on "Collision Layers" which will show the collision layers list. That list represents each collision layer as a letter (from A to J). Each letter has a checkbox associated with it. You enable or disable any of the collision layers by checking or unchecking the associated checkbox.

If you instead were to click on the "Script Menu", it will show a large list of parameters, variables, events, and some other things. One of the items in that list is labeled "CollideSet". The collideset is a numeric representation of the collision layers. For example, if you were to check the "A" checkbox (and leave all others unchecked) on the collision layer list, and then look at the collideSet in the script menu, you will see that it has received the numeric value of "1". You can also do the opposite action, and change the value in CollideSet, which would automatically check or uncheck certain letters in the Collision Layer list. Since you want all collision layers to be active (A to J), then you would need to enter the value "1023" in collideSet. You do that in a spawned object this way: collideSet := 1023

I hope this cleared up any confusion that you may have had about collision layers and collideSet.

Xray

Posts: 489
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

### Re: How do I get all the collision layers to apply to this?

For even more detail, the collide set is a sum of the collision layer values.
Each value is separate and is a power of 2
Code: Select all
`A B C D  E  F  G  H   I   J1 2 4 8 16 32 64 128 256 512`

Add together the numbers of the collision layers you want and you will get the collide set value
for example if you wanted A C E G I, you would add 1 4 16 64 256 with a result of 341

BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999

Posts: 233
Joined: Fri Dec 09, 2011 12:51 am