Re: [Algorithms] Formula for Damping f times
Brought to you by:
vexxed72
|
From: Ola O. <ola...@gm...> - 2009-06-05 12:48:59
|
> x *= 1.0f-(k*deltaTime);
>
> So k = 1 = damped to zero velocity over 1 second at 30fps.
Hm, zero after one second? Really? If we have 30 fps and deltaTime thus is
1/30 (and k = 1 as stated), then the rhs = 29/30, expanding that would mean
that x30 = x0 * (29/30)^30 which is approximately x30 = x0 * 0.36
I did get up at 5am this morning so I apologize if I missed/messed something
here, but that appears a fair way from zero.
cheers
.ola
----- Original Message -----
From: <Pau...@sc...>
To: "Game Development Algorithms" <gda...@li...>
Sent: Friday, June 05, 2009 12:31 PM
Subject: Re: [Algorithms] Formula for Damping f times
> -----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-----
>
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> GDAlgorithms-list mailing list
> GDA...@li...
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
|