Increase mass of an object over time

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

Increase mass of an object over time

Postby thelostmango » Mon Mar 01, 2010 2:51 pm

This is probably really simply, ut i have an object, and I want the mass to increase as time goes.

E.g. the mass starts off at 10kg and every 10 seconds it increases by 1kg. It can be a continuous increase, or a discrete increase. Any ideas?
thelostmango
 
Posts: 2
Joined: Mon Mar 01, 2010 2:48 pm

Re: Increase mass of an object over time

Postby KarateBrot » Mon Mar 01, 2010 3:06 pm

Code: Select all
density = { (10 + 0.1*sim.time) / Area }
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Increase mass of an object over time

Postby thelostmango » Mon Mar 01, 2010 3:44 pm

Thanks for the reply.

Am I doing something wrong, but this only sets the density to be equal to the sim.time once the program is ran at first, but does not change with time.
thelostmango
 
Posts: 2
Joined: Mon Mar 01, 2010 2:48 pm

Re: Increase mass of an object over time

Postby KarateBrot » Mon Mar 01, 2010 6:02 pm

Look closely. I made { } brackets around my code. that's telling algodoo to update the code all the time and not only once. Did you type them in?
And of course you have to put a number for your area in^^ (the area of your geometry)

Edit:
Holy ballz you are right it doesn't work :crazy: for some reason an error message appears telling me that it's not a real. mysterious...
you can make it another way although the way with density updating itself would be the neatest way. Make something collide with the object all the time for example another object or a laser. then again go to the scripting menu of the object and type this into its onCollide / OnLaserHit:
Code: Select all
density = (10 + 0.1*sim.time) / Area

This will work for sure
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 1 guest