How Do you Spawn a Shape With different Collisions?
28 posts • Page 1 of 2 • 1, 2
How Do you Spawn a Shape With different Collisions?
The title says it all, but I will elaborate...
I'm trying to make something where a certain object hits another, and a circle spawns. But, I cant find out how to change what it collides with, e.g right now it only collides with group "a", I want it to collide with b,c, and d... but I cant find out how! Someone HALP!!
I'm trying to make something where a certain object hits another, and a circle spawns. But, I cant find out how to change what it collides with, e.g right now it only collides with group "a", I want it to collide with b,c, and d... but I cant find out how! Someone HALP!!
Last edited by Dezzeron on Wed Nov 11, 2009 10:10 pm, edited 1 time in total.
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
A = 1
B = 2
C = 4
D = 8
E = 16
F = 32
G = 64
add numbers together to get different collideSet values. When you spawn the circle make sure to put collideSet := 22
B = 2
C = 4
D = 8
E = 16
F = 32
G = 64
add numbers together to get different collideSet values. When you spawn the circle make sure to put collideSet := 22
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
And if you want to see which collision layers are included in one number you have to do it this way:
- - - - -
what's the highest power of two that fits in 22? - 16
6 left: what's the highest power of two that fits in 6? - 4
2 left: what's the highest power of two that fits in 2? - 2
- - - - -
so you have the numbers 16, 4 and 2. that's collision layer E, C and B.
With a littlebit of practice you will know them just by looking at it.
- - - - -
what's the highest power of two that fits in 22? - 16
6 left: what's the highest power of two that fits in 6? - 4
2 left: what's the highest power of two that fits in 2? - 2
- - - - -
so you have the numbers 16, 4 and 2. that's collision layer E, C and B.
With a littlebit of practice you will know them just by looking at it.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: How Do you Spawn a Shape With different Collisions?
You are all Awesome!!
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-
monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: How Do you Spawn a Shape With different Collisions?
I still dont understand, can you put the full code?
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
oncollide =
- Code: Select all
(e)=>{scene.addCircle({radius:= "your size"; pos:=e.pos; collideset:=22})}
Last edited by algadoodle123 on Fri Nov 13, 2009 4:38 am, edited 1 time in total.
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
-
algadoodle123 - Posts: 66
- Joined: Tue Sep 08, 2009 6:04 pm
Re: How Do you Spawn a Shape With different Collisions?
Wrong.
- Code: Select all
scene.addCircle({radius := size; pos := e.pos; collideSet := 22})
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
Ok, can you add it on to this code I have so far?
- Code: Select all
(e)=>{
(sim.time > (scene.my.lastshoot + 0.010000001) ? { scene.my.lastshoot = sim.time; scene.addcircle({ pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1] }); scene.addpen({ pos := e.pos; fadetime := 0.1; size = 0.1; color := [1, 1, 0, 0.5] }) } : {}) }
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
- Code: Select all
sim.time > scene.my.lastshoot + 0.010000001 ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 22}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
It still doesnt work, can you make the code so the ball collides with collision groups "b" "c" and "d"? Thanks...
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
*sigh* Add and subtract the collideSet values to get what you want or make an object with the collision layers you want, select it, go to its script menu, and look at the collideSet value. >.> But since you're lazy the collideSet for b, c, and d is 14.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
I'm sorry, but it still doesnt work!
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
Sorry. >.>
- Code: Select all
sim.time > (scene.my.lastshoot + 0.010000001) ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 22}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
The weirdness of the collideset variable is based in binary. If you take the number for a given combination of collision sets and translate it into binary, you will get a very neat display in which each digit represents a collision group. If it's one, it collides with that group, and if it's zero, then it doesn't.
0000001 = 1 = A
0000000 = 0 = none
1111111 = 127 = all
0101010 = 42 = B, D, F
0001000 = 8 = D
0000001 = 1 = A
0000000 = 0 = none
1111111 = 127 = all
0101010 = 42 = B, D, F
0001000 = 8 = D
Made some cool stuff a long time ago
-
Frank - [Best Tutorial Maker 2010]
- Posts: 193
- Joined: Mon Aug 31, 2009 6:37 pm
- Location: the dark side of the moon
Re: How Do you Spawn a Shape With different Collisions?
Dammit! It STILL doesnt work! Make sure you make it collide with "b" "c" and "d"!
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
God! Why can't you learn to edit a goddamn script! >:C
- Code: Select all
sim.time > (scene.my.lastshoot + 0.010000001) ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 14}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
Dezzeron wrote:Dammit! It STILL doesnt work! Make sure you make it collide with "b" "c" and "d"!
You're the one who can't understand simple things. You can even observe it in-game without asking here.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: How Do you Spawn a Shape With different Collisions?
I did edit the script, and it doesnt work! I dont know why, I did everything I was supposed to...
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
Did the script I just post work? It does for me. Did you declare scene.my.lastshoot?
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
standardtoaster wrote:Did the script I just post work? It does for me. Did you declare scene.my.lastshoot?
What do you mean? I am such a noob to scripting...
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
Declaring a variable: Press ~ or F11, type scene.my.lastshoot = 0, press enter, now put this script into the onCollide of the object.
- Code: Select all
sim.time > (scene.my.lastshoot + 0.010000001) ? {scene.my.lastshoot = sim.time; scene.addCircle({pos := e.pos; radius := 0.050000001; density := 5500000; color := [0, 0, 0, 1]; collideSet := 14}); scene.addPen({pos := e.pos; fadeTime := 0.1; size := 0.1; color := [1, 1, 0, 0.5]})} : {}
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
It still doesnt work... do you want me to upload the scene so you can try? I swear, it is really screwed up...
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
Jesus christ... How is it that your are messing it up? I have tested this script at least ten times now and it works every time.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How Do you Spawn a Shape With different Collisions?
I dont know, it... gah... just for get it.
Check out my stuff HERE!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
MY WEB SITE HERE!
Sorry, I just had to.
Phundamentalist!
Mystery wrote:I'm convinced that dezzerons scenes are all epic. He's one of the biggest underdogs of algobox.
-
Dezzeron - Posts: 296
- Joined: Tue Sep 01, 2009 12:45 am
- Location: Dark Side Of The Moon
Re: How Do you Spawn a Shape With different Collisions?
If you could upload the scene I can make it work.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
28 posts • Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 18 guests