on layer hit = kill ?
7 posts • Page 1 of 1
on layer hit = kill ?
how to make that?
when a object hit by layer, then that object will be killed
thx
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 ?
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}}
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 ?
I'm wrong...sorry, it should be "laser"
thx
thx
- dogwong
- Posts: 8
- Joined: Wed Oct 21, 2009 12:28 pm
Re: on layer hit = kill ?
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.
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.
- 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.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: on layer hit = kill ?
I would put airfrictionmult to -inf then it gets rid of the object without glitches
<- Designed by PhysicsGuy
-
xplane80 - Posts: 498
- Joined: Mon Aug 31, 2009 7:28 pm
Re: on layer hit = kill ?
or
Which would "delete" it.. as it no longer collide, is seen nor creates air friction..
- 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
No really just PM me if you have a problem
-
Sniperkasa - Posts: 493
- Joined: Tue Sep 01, 2009 5:34 pm
- Location: The bottom of a lake.
Re: on layer hit = kill ?
Also, airfriction dosn't affect glued objects, only free moving ones.
-
Versieon - Posts: 375
- Joined: Tue Sep 01, 2009 4:45 pm
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests