How to write an acceleration equation in thyme?

If you have problems installing or running Algodoo, have found a bug or need in-game help - this is it!

How to write an acceleration equation in thyme?

Postby faytree » Thu Feb 14, 2019 12:38 pm

Is there any possible way to write a code to determine the acceleration of an object ( both horizontal acceleration and vertical acceleration separately ) ? :|
I'm back from the "dead"
User avatar
faytree
 
Posts: 942
Joined: Mon Nov 05, 2012 1:37 pm
Location: uhhh Jakku

Re: How to write an acceleration equation in thyme?

Postby FRA32 » Sun Feb 17, 2019 3:17 pm

Thats totally simple tho and should be asked in the thyme subforum. Just declare a variable _prevVel = vel (using the black mini console of your object), and then calculate the accelleration using poststep:

accell = (vel-_prevVel)/e.dt;
_prevVel = vel;

The entire accelleration would be math.vec.len(accell) while the components would be accell(0) and accell(1)
FRA32
 
Posts: 213
Joined: Wed Dec 03, 2014 9:51 pm

Re: How to write an acceleration equation in thyme?

Postby faytree » Sun Feb 24, 2019 10:07 am

FRA32 wrote:Thats totally simple tho and should be asked in the thyme subforum. Just declare a variable _prevVel = vel (using the black mini console of your object), and then calculate the accelleration using poststep:

accell = (vel-_prevVel)/e.dt;
_prevVel = vel;

The entire accelleration would be math.vec.len(accell) while the components would be accell(0) and accell(1)


Thanks a lot, your method is much simpler and effective comparing to other methods :thumbup:
I'm back from the "dead"
User avatar
faytree
 
Posts: 942
Joined: Mon Nov 05, 2012 1:37 pm
Location: uhhh Jakku


Return to Help / Bug reports

Who is online

Users browsing this forum: No registered users and 2 guests

cron