I'm making a few simple dolly camera system however, when I'm using the preset positions, for a single frame it render's the client's normal view instead of the one we're transferring to.
I guess is that while we're switching the current node to the next node the client cannot process that quick enough in a single frame. Is there any fix I could possibly preform so it looks more smooth?
[CODE]
TrackID = 1
arrarrCameraTracks = {
{
m_Position = Vector(-1009.537659, 999.716431, -12248.071289),
m_Angles = Angle(25.847267, -47.475945, 0.000000)
},
{
m_Position = Vector(-978.167664, -944.607849, -12239.663086),
m_Angles = Angle(12.012007, 43.901100, 0.000000)
},
{
m_Position = Vector(938.309570, -923.356140, -12245.787109),
m_Angles = Angle(11.368503, 133.991104, 0.000000)
},
{
m_Position = Vector(926.294739, 948.870789, -12233.302734),
m_Angles = Angle(16.194736, -133.988449, 0.000000)
},
}
local iRuntime = 5
local iTimeLerp = CurTime() + iRuntime
local p_NextTrack = arrCameraTracks[2]
local p_CurrentTrack = arrCameraTracks[1]
hook.Add( "CalcView", "CamTick", function()
local value = math.Clamp(iTimeLerp - CurTime() / iRuntime, 0, 1)
if value <= 0 then
TrackID = TrackID + 1
iTimeLerp = CurTime() + iRuntime
p_NextTrack = arrCameraTracks[TrackID + 1]
p_CurrentTrack = arrCameraTracks[TrackID]
if TrackID >= #arrCameraTracks then
chat.AddText("Restarting to ID 1")
TrackID = 1
p_NextTrack = arrCameraTracks[TrackID + 1]
p_CurrentTrack = arrCameraTracks[TrackID]
end
else
local view = {}
view.origin = LerpVector(value, p_NextTrack.m_Position, p_CurrentTrack.m_Position)
view.angles = LerpAngle(value, p_NextTrack.m_Angles, p_CurrentTrack.m_Angles)
return view
end
end )
[/CODE]
The client will wait as long as it takes for a frame to render. More than likely you have an <=/>= where your should have a </> or vice versa.
Don't they both take up the same amount of time?
Specifically, you're not rendering the view at
[code]if value <= 0 then[/code]
Sorry, you need to Log In to post a reply to this thread.