[sldev] Calculating accurate avatar positions
Thickbrick Sleaford
thickbrick.sleaford at gmail.com
Sat Jan 9 04:43:14 PST 2010
On Friday 08 January 2010 20:51:18 Dahlia Trimble wrote:
> I thought each terse update packet includes the sim time dilation at the
> time the update was generated. Could this be used to scale the velocity to
> slow the motion down? (if it's not already). May not help for network lag
> but should help for heavily loaded sims.
>
> -Dahlia
>
The time dilation is used in LLViewerObject::idleUpdate (llviewerobject.cpp
starting at around line 1980.) every frame to interpolate velocity, position
angular velocity, and rotation for moving objects.
Maybe an optimization could be to factor in the sim's last known time dilation
somehow together with the time dilation when the interpolated object last
received an update (mTimeDilation)?
I think the way it tries to compensate for the fact that the sim sends
velocity averaged over the last sim frame is wrong. I think for the case of
constant acceleration this would be wrong:
LLVector3 delta_pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt;
(dt there is the time since the last viewer frame (compensated for sim time
dilation). That doesn't make much sense to me, but maybe I'm missing
something.
A better way is to do:
vel = vel + accel * (0.5f * PHYSICS_TIMESTEP * mTimeDilation)
in LLViewerObject::processUpdateMessage.
Also, note that ping interpolation doesn't do what it says it does
(https://jira.secondlife.com/browse/SNOW-390 )
Thickbrick
More information about the SLDev
mailing list