forked from hkc/cc-stuff
wallhack: fix sign of pitch to vector conversion
This commit is contained in:
parent
23f5549ee1
commit
00f4add81e
|
@ -2,15 +2,18 @@ return function()
|
||||||
local playerLookVector = nil
|
local playerLookVector = nil
|
||||||
|
|
||||||
local function updateLookVector()
|
local function updateLookVector()
|
||||||
-- pitch:
|
-- yaw:
|
||||||
-- 0 => positive Z
|
-- 0 => positive Z
|
||||||
-- 90 => negative X
|
-- 90 => negative X
|
||||||
|
-- pitch:
|
||||||
|
-- 0 => forward
|
||||||
|
-- 90 => down
|
||||||
local yawr = math.rad(player.yaw)
|
local yawr = math.rad(player.yaw)
|
||||||
local pitchr = math.rad(player.pitch)
|
local pitchr = math.rad(player.pitch)
|
||||||
local cosPitch = math.cos(pitchr)
|
local cosPitch = math.cos(pitchr)
|
||||||
local x = cosPitch * -math.sin(yawr)
|
local x = cosPitch * -math.sin(yawr)
|
||||||
local z = cosPitch * math.cos(yawr)
|
local z = cosPitch * math.cos(yawr)
|
||||||
local y = math.sin(pitchr)
|
local y = -math.sin(pitchr)
|
||||||
playerLookVector = {x, y, z, x = x, y = y, z = z}
|
playerLookVector = {x, y, z, x = x, y = y, z = z}
|
||||||
return playerLookVector
|
return playerLookVector
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue