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

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

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

Postby decepticon » Sat May 13, 2017 9:28 pm

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?

Postby electronicboy » Mon May 15, 2017 7:20 pm

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
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1693
Joined: Mon Aug 31, 2009 6:18 pm

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

Postby Xray » Fri Jun 09, 2017 6:42 am

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.
User avatar
Xray
 
Posts: 484
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

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

Postby jon_joy_1999 » Tue Aug 01, 2017 9:45 pm

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
Image
BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999
 
Posts: 233
Joined: Fri Dec 09, 2011 12:51 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron