From 3c32bd9d60a8ebc781ff182711ed270c623b93fc Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Wed, 22 Dec 2021 23:34:53 -0600 Subject: [PATCH] Fix front pos util --- scripts/shared/utilities.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/shared/utilities.js b/scripts/shared/utilities.js index 10ed872c..9fa21035 100644 --- a/scripts/shared/utilities.js +++ b/scripts/shared/utilities.js @@ -795,15 +795,20 @@ function getPosInFrontOfPos(pos, angle, distance) { let y = pos.y; let z = pos.z; - if(getGame() < VRR_GAME_MAFIA_ONE) { + if(getGame() != VRR_GAME_MAFIA_ONE) { + x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance)); y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance)); } else { - angle = radToDeg(angle); + while(angle < 0.0) + angle += 360.0; + + while(angle > 360.0) + angle -= 360.0; + + x = (pos.x+((Math.cos(angle-(Math.PI/2)))*distance)); z = (pos.z+((Math.sin(angle+(Math.PI/2)))*distance)); } - x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance)); - return toVector3(x, y, z); }