Re: [Algorithms] Formula for Damping f times
Brought to you by:
vexxed72
From: <Pau...@sc...> - 2009-06-05 10:31:24
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 > Hi, > This is a semi-trivial but I can't quite remember the answer, even > though I've done it before. > > I have an update function sort of like this.. > > void updateX( float deltaTime) > { > x = x*k; > } > > k is a constant less than 1.0. > > Now to do the damping properly I need to perform "x=x*k" deltaTime > times, where deltaTime is a fraction. > > Can anyone help with this please? I recall it just being a log or > something. We just do something very simple: x *= 1.0f-(k*deltaTime); So k = 1 = damped to zero velocity over 1 second at 30fps. Cheers, Paul. ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify pos...@sc... This footnote also confirms that this email message has been checked for all known viruses. Sony Computer Entertainment Europe Limited Registered Office: 10 Great Marlborough Street, London W1F 7LP, United Kingdom Registered in England: 3277793 ********************************************************************** P Please consider the environment before printing this e-mail -----BEGIN PGP SIGNATURE----- Version: PGP Universal 2.9.1 (Build 287) Charset: US-ASCII wsBVAwUBSijz83ajGqjtoMHxAQh+mwgAgByk+DsOHJIg2O411+jQwAialPE3VZ7x QMb1t6mG2Ujx8niel3gT9u1PoGEMNiV1rjAvV2O9mCeGgEI4NE9ZDcgB3JF9DJbB eq/lNz/EJDaL+deC8wYyyW5TGJoTKW5fz2WvpYmia0RniH1wuLDmjQJR0d2aGbIM knI7FpZVEDjMtRvK5nwGJNWkoaiBInSTLJ3+rYrZbtVxeC0AVPgp4lrPL9zGQmpE M8CKMs67cwn7xZJnJOTqfdAbnavapIxSvDtAZBDNB7Ba/kX552mv0E+0nMgj4bzC 9ft1PoF+05psOXKvCGJXDX3uVpJSJM9OL3SVfC57i114dnDsgfiNTA== =tza9 -----END PGP SIGNATURE----- |