OnCollide weight

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

OnCollide weight

Postby jimmyy1992 » Fri Jan 08, 2010 10:46 am

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)
jimmyy1992
 
Posts: 5
Joined: Fri Jan 08, 2010 10:32 am

Re: OnCollide weight

Postby Kilinich » Fri Jan 08, 2010 1:28 pm

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..
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: OnCollide weight

Postby jimmyy1992 » Fri Jan 08, 2010 1:43 pm

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

Postby Kilinich » Fri Jan 08, 2010 2:26 pm

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...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: OnCollide weight

Postby RA2lover » Fri Jan 08, 2010 2:38 pm

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
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: OnCollide weight

Postby jimmyy1992 » Sun Jan 10, 2010 1:51 pm

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

Postby Chronos » Tue Jan 12, 2010 4:51 pm

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
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: OnCollide weight

Postby jimmyy1992 » Tue Jan 12, 2010 10:24 pm

Jiiha... iit works fine!! Thanks!!
jimmyy1992
 
Posts: 5
Joined: Fri Jan 08, 2010 10:32 am

Re: OnCollide weight

Postby KarateBrot » Wed Jan 13, 2010 7:12 pm

It you want it to be realistic you need to think of something different
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: OnCollide weight

Postby jimmyy1992 » Wed Jan 13, 2010 7:50 pm

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 :D
jimmyy1992
 
Posts: 5
Joined: Fri Jan 08, 2010 10:32 am

Re: OnCollide weight

Postby KarateBrot » Wed Jan 13, 2010 11:46 pm

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.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron