Object delete code

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

Object delete code

Postby laserfishy » Sat Jan 29, 2011 1:48 am

Setting density := 0 crashes phun/algodoo, but i want my object to delete!

solution: set airFrictionMult:= -inf and the object deletes itself instantly
"Never take life seriously, nobody gets out alive anyways"
User avatar
laserfishy
 
Posts: 16
Joined: Wed Jul 21, 2010 6:36 am

Re: Object delete code

Postby hiltropper » Sat Jan 29, 2011 2:32 am

it crashes? on my pc , both works :?:
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: Object delete code

Postby Someone Else » Sat Jan 29, 2011 3:40 am

I was told that density = 0 will crash Phun.
Setting just about anything equal to NaN will delete it, but may also delete some other things that you want to keep.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Object delete code

Postby TC42 » Sat Jan 29, 2011 4:05 am

If you have algodoo, you can also set the inertiamultiplier to 0, hehehehehe. :lol:
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: Object delete code

Postby davidz40 » Sat Jan 29, 2011 8:26 pm

Density=0 indeed crashes phun.
AirFrictionMult=-inf deletes object, but that object exerts infinite force at anything it touches, deleting it too. Good way to avoid this is to set collideset to 0 first.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: Object delete code

Postby hiltropper » Sat Jan 29, 2011 11:43 pm

okay didnt know started scripting after i bought algodoo so never tried some scripts in phun
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: Object delete code

Postby TC42 » Thu Mar 10, 2011 1:26 am

*bump*
:D
I dunno if this is common knowledge or not, but to delete a spring, set the length to +inf or -inf.
This will delete the spring without affecting anything else.
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: Object delete code

Postby Rideg » Sat Mar 12, 2011 5:45 pm

TC42 wrote:*bump*
:D
I dunno if this is common knowledge or not, but to delete a spring, set the length to +inf or -inf.
This will delete the spring without affecting anything else.

I did not know of that. Thanks for sharing.
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Object delete code

Postby SyntaxError » Sun May 01, 2011 4:04 pm

Here another way to delete the object:
Works only in scenes without water but it does not effect other objects, even hinged or fixed to the deleted one.

Code: Select all
(e)=>{e.geom.liquify;scene.erasewater}
User avatar
SyntaxError
 
Posts: 11
Joined: Sat Apr 30, 2011 9:00 pm

Re: Object delete code

Postby Someone Else » Sun May 01, 2011 8:02 pm

You can also delete by spawning two killers in the same place, or spawning one circle with infinite restitution and a script to change its collideSet and e.other.collideSet to 0. More complicated, but the best way I've found that should work in Phun in a vacuum.

I still haven't found a way to delete a hinge when there are no forces being acted upon it.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Object delete code

Postby bozbez » Sun May 01, 2011 9:11 pm

Setting an objects density to NaN works as well :)
Image

Go here. Now. That's Now. Not in 5 minutes. Now.
User avatar
bozbez
 
Posts: 149
Joined: Tue Apr 12, 2011 7:01 pm

Re: Object delete code

Postby SyntaxError » Sun May 01, 2011 10:24 pm

Wow, there are really many ways to handle this.

Should be put into the tutorial page
User avatar
SyntaxError
 
Posts: 11
Joined: Sat Apr 30, 2011 9:00 pm

Re: Object delete code

Postby Someone Else » Sun May 01, 2011 11:30 pm

I actually tried density = NaN and it didn't work. :wtf:
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Object delete code

Postby bozbez » Sun May 01, 2011 11:35 pm

Someone Else wrote:I actually tried density = NaN and it didn't work. :wtf:

In Algodoo?
Image

Go here. Now. That's Now. Not in 5 minutes. Now.
User avatar
bozbez
 
Posts: 149
Joined: Tue Apr 12, 2011 7:01 pm

Re: Object delete code

Postby Someone Else » Sun May 01, 2011 11:49 pm

In Algodoo. Maybe I made it not work by saying collideSet = 0; density = NaN? So the circles couldn't collide and then spontaneously delete themselves?
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Object delete code

Postby bozbez » Mon May 02, 2011 12:17 am

Didn't test it in Algodoo.
It shouldn't matter if you change the collideSet, but you don't need to.
Image

Go here. Now. That's Now. Not in 5 minutes. Now.
User avatar
bozbez
 
Posts: 149
Joined: Tue Apr 12, 2011 7:01 pm

Re: Object delete code

Postby Chronos » Mon May 02, 2011 2:22 am

You don't use density = NaN for Algodoo, do you? I thought you used density = 0.
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: Object delete code

Postby Someone Else » Mon May 02, 2011 3:06 am

I tried and failed to use density = NaN because it should work in Phun.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests