Re: [TuxKart-devel] Patch for smooth camera motion...
Status: Alpha
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-07-14 20:47:58
|
Kevin Cowtan wrote: > > Steve Baker wrote: > > Do you think the 0.2 and 0.1's here should actually be somehow > > related to the time delta between frames? > > > > > ! steady_cam.xyz[0] = steady_cam.xyz[0] + 0.2f*diff.xyz[0]; > > > ! steady_cam.xyz[1] = steady_cam.xyz[1] + 0.2f*diff.xyz[1]; > > > ! steady_cam.xyz[2] = steady_cam.xyz[2] + 0.2f*diff.xyz[2]; > > > ! steady_cam.hpr[0] = steady_cam.hpr[0] + 0.1f*diff.hpr[0]; > > > ! steady_cam.hpr[1] = steady_cam.hpr[1] + 0.1f*diff.hpr[1]; > > > ! steady_cam.hpr[2] = steady_cam.hpr[2] + 0.1f*diff.hpr[2]; > > > > It seems like this would look different on a high frame rate machine > > than on a low rate system. > > Oh yes, you are absolutely right. The values either need to be scaled > proportionally to the time since the last frame, or there needs to be > some sort of time based history mechanism (which I presume is what your > cart history does). Yep - I just need to change those 0.1/0.2 values into <something>*delta_t Those hard-coded numbers seem to look good at ~30Hz frame rate - so <something> should be about 30*0.1 and 30*0.2 or so. > I initially meant to have a look and see if this routine was driven off > a timer or off the frame update, and then didn't get round to it. It's executed once per frame (unless you have a VERY slow PC) and the timer sets delta_t to ensure your speed is not affected by the frame rate. > Also, from the code, it looks like there is the possibility > (unimplemented?) of flipping the view between karts. My patch will cause > the camera to spin erratically through walls if this happens. Actually, it is implemented - page-up and page-down steps through a number of fixed cameras and each of the karts in turn. It's useful when debugging (eg "Gown doesn't seem to be moving anymore - I wonder what went wrong" - I can move the camera to follow her and see why she's driving around in circles or whatever). We should implement that properly and have a 1st person view, a far distant view, a close up view and a view looking backwards or something. It won't be hard to fix your code so that the camera can 'teleport' between views rather than interpolating it's way across half the 'world'. -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |