Re: [Algorithms] Formula for Damping f times
Brought to you by:
vexxed72
From: Alen L. <ale...@cr...> - 2009-06-09 08:32:30
|
I guess you use this only if you run with fixed timestep of 20fps? Aeln Richard wrote at 6/9/2009: > the only robust solution i have found to this situation has been to > create a sub second k and apply it multiple times. > float subTimeStep = 0.05f; // 20fps > subK = exp(log(k)*subTimeStep); > mUpdateTimer += deltaTime; > while( mUpdateTimer > 0 ) > { > mUpdateTimer -= subTimeStep; > x = x*subK; > } > anything else either is slower, or has accuracy issues that make > network code impossible to debug. > 2009/6/5 Zafar Qamar <zaf...@co...>: >> 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. >> >> Cheers >> Zafar Qamar >> ********************************************************************************** >> Disclaimer >> >> The information and attached documentation in this e-mail is intended for the use of the addressee only and is confidential. If you are not the intended recipient please delete it and notify us immediately by telephoning or e-mailing the sender. Please note that without Codemasters’ prior written consent any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. >> >> Attachments to this e-mail may contain software viruses. You are advised to take all reasonable precautions to minimise this risk and to carry out a virus check on any documents before they are opened. >> >> Any offer contained in this communication is subject to Codemasters’ standard terms & conditions and must be signed by both parties. Except as expressly provided otherwise all information and attached documentation in this e-mail is subject to contract and Codemasters’ board approval. >> Any views or opinions expressed are solely those of the author and do not necessarily represent those of Codemasters. >> >> This footnote also confirms that this email message has been swept by >> SurfControl for the presence of computer viruses. >> ********************************************************************************** >> >> >> ------------------------------------------------------------------------------ >> 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 -- Alen |