Page 1 of 1

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

PostPosted: Sat May 13, 2017 9:28 pm
by decepticon
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

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

PostPosted: Mon May 15, 2017 7:20 pm
by electronicboy
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

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

PostPosted: Fri Jun 09, 2017 6:42 am
by Xray
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.

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

PostPosted: Tue Aug 01, 2017 9:45 pm
by jon_joy_1999
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   J
1 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