OnCollide weight
11 posts • Page 1 of 1
OnCollide weight
Hi
I want to simulate a blak hole. To do that, i have to do a object1(black hole), that kills an colliding object2. and at the same time the object1 (black hole) must get the mass of the killed object!! how is the script code??
can anybody help? thx
(of course the black hole will have an attraction)
I want to simulate a blak hole. To do that, i have to do a object1(black hole), that kills an colliding object2. and at the same time the object1 (black hole) must get the mass of the killed object!! how is the script code??
can anybody help? thx
(of course the black hole will have an attraction)
- jimmyy1992
- Posts: 5
- Joined: Fri Jan 08, 2010 10:32 am
Re: OnCollide weight
For that you need to store mass somewhere (for example in unused controllerAcc property) and read it onCollide.
For 1sq.m black hole object:
p.s. density=0 works only in algodoo, in Phun you should try airFricionMult = NaN or something like that..
For 1sq.m black hole object:
- Code: Select all
onCollide = (e) => {density = density + e.other.controllerAcc; e.other.controllerAcc = 0; e.other.Density = 0}
p.s. density=0 works only in algodoo, in Phun you should try airFricionMult = NaN or something like that..
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: OnCollide weight
okey..thanks!! is it possible to make a killer?? is it still a collision?
- jimmyy1992
- Posts: 5
- Joined: Fri Jan 08, 2010 10:32 am
Re: OnCollide weight
jimmyy1992 wrote:okey..thanks!! is it possible to make a killer?? is it still a collision?
Yes it's possible to add killer geometry but it should be slightly smaller than blackhole one. Killer itself will not generate onCollide event.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: OnCollide weight
it can generate it on immortal objects
Jrv wrote:TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.
GTFO newfgt
-
RA2lover - Posts: 607
- Joined: Mon Aug 31, 2009 8:43 pm
- Location: Brazil
Re: OnCollide weight
Kilinich wrote:For that you need to store mass somewhere (for example in unused controllerAcc property) and read it onCollide.
For 1sq.m black hole object:
- Code: Select all
onCollide = (e) => {density = density + e.other.controllerAcc; e.other.controllerAcc = 0; e.other.Density = 0}
p.s. density=0 works only in algodoo, in Phun you should try airFricionMult = NaN or something like that..
sorry i tryed it out. and it didn't work. object1 didn't get the mass of object 2.. all the rest worked fine thanks..
why? thanks
ps: i have algodoo
- jimmyy1992
- Posts: 5
- Joined: Fri Jan 08, 2010 10:32 am
Re: OnCollide weight
jimmyy1992 wrote:Kilinich wrote:For that you need to store mass somewhere (for example in unused controllerAcc property) and read it onCollide.
For 1sq.m black hole object:
- Code: Select all
onCollide = (e) => {density = density + e.other.controllerAcc; e.other.controllerAcc = 0; e.other.Density = 0}
p.s. density=0 works only in algodoo, in Phun you should try airFricionMult = NaN or something like that..
sorry i tryed it out. and it didn't work. object1 didn't get the mass of object 2.. all the rest worked fine thanks..
why? thanks
ps: i have algodoo
Try:
- Code: Select all
onCollide=(e)+=>{density = (density + e.other.density); e.other.density = 0}
Phun version:
- Code: Select all
onCollide=(e)+=>{density = (density + e.other.density); e.other.airFrictionMult - NaN}
And put either in the black hole object.
TheWinkits wrote:They both looks of cuking amazing
-
Chronos - [Most Active Member 2010]
- Posts: 4457
- Joined: Mon Aug 31, 2009 6:00 pm
- Location: Californania
Re: OnCollide weight
Jiiha... iit works fine!! Thanks!!
- jimmyy1992
- Posts: 5
- Joined: Fri Jan 08, 2010 10:32 am
Re: OnCollide weight
It you want it to be realistic you need to think of something different
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: OnCollide weight
KarateBrot wrote:It you want it to be realistic you need to think of something different
okeii.. have you any good suggestion? =)
thanks for your advise
- jimmyy1992
- Posts: 5
- Joined: Fri Jan 08, 2010 10:32 am
Re: OnCollide weight
hmm yeah i thought of it a bit but i don't think if it really should be realistic you have to assign a variable for each object that includes it's mass to make it realistic. for example with controlleracc like kilinich said before but if it doesn't work there are still other possibilities to assign mass.
And dependent on the mass of the black hole you could make the radius of it's event horizon geting bigger with "New method". you have to erase the old black hole and at the same position (you need new method to detect it) it spawns a new circle with a bigger radius. i hope it will look like it's getting bigger.
And dependent on the mass of the black hole you could make the radius of it's event horizon geting bigger with "New method". you have to erase the old black hole and at the same position (you need new method to detect it) it spawns a new circle with a bigger radius. i hope it will look like it's getting bigger.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
11 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests