forked from hkc/cc-stuff
1
0
Fork 0

wallhack: fix sign of pitch to vector conversion

This commit is contained in:
Vftdan 2023-10-13 15:15:40 +03:00
parent 23f5549ee1
commit 00f4add81e
1 changed files with 5 additions and 2 deletions

View File

@ -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