Game Development Community

Slow Motion using timeScale affects mouse control

by Steve Lamperti · in Torque Game Engine · 08/21/2006 (3:09 pm) · 2 replies

I'm using the timeScale variable to slow down time in my project. This works great, except that when time is slowed down, the mouse control is negatively affected. In this post

http://www.garagegames.com/mg/forums/result.thread.php?qt=21358

Luke D gives a pretty good description of what is happening. What I would like to know, is if there is a way to slow down time without affecting the mouse control. He suggests in that post to scale the x and y movements, but I still think that with the sampling rate changed that would not have a very smooth effect.

What I want to do, is to scale time down without affecting the sampling rate, or the redraw rate.

If anyone has any suggestions I would appreciate hearing them.

Thanks

#1
08/23/2006 (10:20 am)
After looking at how gTimeScale changes timeDelta in processTimeEvent in main.cc, I was wondering if I might accomplish what I want to by adding an additional variable, which is not affected by gTimeScale, and calling Sim::AdvanceTime with the timeDelta, and then calling serverProcess and clientProcess with the new variable which is timeDelta unmodified. (I.e. what timeDelta would be if gTimeScale were 1.0.)

I'll go ahead and try this, but if anyone that understands this code knows if this is just crazy, or not, I would appreciate hearing about it.

Thanks
#2
08/23/2006 (1:31 pm)
Turns out that the variables I was referring to in the last post, in processTimeEvent, are both there already. The variable elapsedTime is just the time the event wants to have elapse, while timeDelta is elapsedTime * gTimeScale.

Interestingly, there are four calls to which these time values are passed:

Platform::advanceTime, serverProcess, Sim::advanceTime, and clientProcess.

currently Platform::advanceTime is the only one getting the original elapsedTime variable, (i.e. the time without the scale modification,) the other three calls get timeDelta.

I'm not sure if this makes sense, or not.

No one has any thoughts on this?

Thank