Optimized spectator hologram
This commit is contained in:
parent
b700d3c109
commit
750831645d
1 changed files with 9 additions and 6 deletions
|
@ -91,11 +91,15 @@ if player() == owner() then do
|
|||
else
|
||||
--Freecam
|
||||
local position = eyePos()
|
||||
local lastSentPosition = eyePos()
|
||||
|
||||
timer.create("updateholo", 1, 0, function()
|
||||
net.start("LSFT-LoadHolo-Update")
|
||||
net.writeVector(position)
|
||||
net.send()
|
||||
timer.create("updateholo", 0.25, 0, function()
|
||||
if position:getDistance(lastSentPosition) > 10 then
|
||||
net.start("LSFT-LoadHolo-Update")
|
||||
net.writeVector(position)
|
||||
net.send()
|
||||
lastSentPosition = position
|
||||
end
|
||||
end)
|
||||
|
||||
hook.add("calcview", "freecam", function(posin, angin, fovin, znearin, zfarin)
|
||||
|
@ -140,9 +144,8 @@ if player() == owner() then do
|
|||
local up = bool_to_number(input.isKeyDown(KEY_UP)) - bool_to_number(input.isKeyDown(KEY_DOWN))
|
||||
|
||||
local thing = Vector(forward, left, 0)
|
||||
thing:rotate(Angle(elevation, bearing, 0))
|
||||
|
||||
position = position + thing * SPEED * (input.isKeyDown(KEY_RUN) and MULTIPLER or 1) * (timer.frametime()/(1/(200/3)))
|
||||
position = position + thing:getRotated(Angle(elevation, bearing, 0)) * SPEED * (input.isKeyDown(KEY_RUN) and MULTIPLER or 1) * (timer.frametime()/(1/(200/3)))
|
||||
position = position + up * Vector(0,0,SPEED) * (input.isKeyDown(KEY_RUN) and MULTIPLER or 1) * (timer.frametime()/(1/(200/3)))
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue