on layer hit = kill ?

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

on layer hit = kill ?

Postby dogwong » Fri Oct 23, 2009 8:51 am

how to make that?

when a object hit by layer, then that object will be killed

thx
dogwong
 
Posts: 8
Joined: Wed Oct 21, 2009 12:28 pm

Re: on layer hit = kill ?

Postby immibis » Fri Oct 23, 2009 9:02 am

I think you mean laser, not layer (correct me if I'm wrong).
Try setting the density to NaN in the onLaserHit script: (e)=>{e.geom.density = NaN}
If you don't want it to kill immortal objects then use this: (e)=>{e.geom.immortal ? {} : {e.geom.density = NaN}}
Thymechanic
immibis
 
Posts: 87
Joined: Wed Sep 30, 2009 12:24 am

Re: on layer hit = kill ?

Postby dogwong » Fri Oct 23, 2009 9:28 am

I'm wrong...sorry, it should be "laser"

thx
dogwong
 
Posts: 8
Joined: Wed Oct 21, 2009 12:28 pm

Re: on layer hit = kill ?

Postby KarateBrot » Fri Oct 23, 2009 11:31 am

Depending on what you want to do sometimes it's even better to use density = 0 since Algodoo can handle this. Phun would crash in some cases.

Code: Select all
OnLaserHit = (e) => { density = 0 }


The difference using this instead of NaN is that you only delete the geometry that's hit by the laser. With NaN every geometry that's colliding at the moment will be deleted, too. So with density = NaN you can delete a big group of objects where the geometry is attached to or is colliding with and with density = 0 you can delete this specific geometry without affecting other geometries.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: on layer hit = kill ?

Postby xplane80 » Sat Oct 24, 2009 6:27 pm

I would put airfrictionmult to -inf then it gets rid of the object without glitches
Image<- Designed by PhysicsGuy
User avatar
xplane80
 
Posts: 498
Joined: Mon Aug 31, 2009 7:28 pm

Re: on layer hit = kill ?

Postby Sniperkasa » Sat Oct 24, 2009 6:30 pm

or
Code: Select all
{e.geom.color = [0.0,0.0,0.0,0.0]; e.geom.drawBorder = false; e.geom.collideSet = 0; e.geom.airFrictionMult= 0; e.geom.density = 0.000000000000000000000000000000000001}

Which would "delete" it.. as it no longer collide, is seen nor creates air friction..
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem :)
User avatar
Sniperkasa
 
Posts: 493
Joined: Tue Sep 01, 2009 5:34 pm
Location: The bottom of a lake.

Re: on layer hit = kill ?

Postby Versieon » Sat Oct 24, 2009 6:33 pm

Also, airfriction dosn't affect glued objects, only free moving ones.
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests