Increase mass of an object over time
4 posts • Page 1 of 1
Increase mass of an object over time
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?
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
- Code: Select all
density = { (10 + 0.1*sim.time) / Area }
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Increase mass of an object over time
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.
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
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 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:
This will work for sure
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 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
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests