Page 1 of 1

How to write an acceleration equation in thyme?

PostPosted: Thu Feb 14, 2019 12:38 pm
by faytree
Is there any possible way to write a code to determine the acceleration of an object ( both horizontal acceleration and vertical acceleration separately ) ? :|

Re: How to write an acceleration equation in thyme?

PostPosted: Sun Feb 17, 2019 3:17 pm
by FRA32
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)

Re: How to write an acceleration equation in thyme?

PostPosted: Sun Feb 24, 2019 10:07 am
by faytree
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: