Page 1 of 1

Increase mass of an object over time

PostPosted: Mon Mar 01, 2010 2:51 pm
by thelostmango
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?

Re: Increase mass of an object over time

PostPosted: Mon Mar 01, 2010 3:06 pm
by KarateBrot
Code: Select all
density = { (10 + 0.1*sim.time) / Area }

Re: Increase mass of an object over time

PostPosted: Mon Mar 01, 2010 3:44 pm
by thelostmango
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.

Re: Increase mass of an object over time

PostPosted: Mon Mar 01, 2010 6:02 pm
by KarateBrot
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