Move vec utils to shared
This commit is contained in:
@@ -327,3 +327,57 @@ function getPlayerFromParams(params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function getPosToRightOfPos(pos, angle, distance) {
|
||||||
|
let x = (pos.x+((Math.cos((-angle+1.57)+(Math.PI/2)))*distance));
|
||||||
|
let y = (pos.y+((Math.sin((-angle+1.57)+(Math.PI/2)))*distance));
|
||||||
|
|
||||||
|
let rightPos = toVector3(x, y, pos.z);
|
||||||
|
|
||||||
|
return rightPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function getPosToLeftOfPos(pos, angle, distance) {
|
||||||
|
let x = (pos.x+((Math.cos((angle+1.57)+(Math.PI/2)))*distance));
|
||||||
|
let y = (pos.y+((Math.sin((angle+1.57)+(Math.PI/2)))*distance));
|
||||||
|
|
||||||
|
let leftPos = toVector3(x, y, pos.z);
|
||||||
|
|
||||||
|
return leftPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function getPosInFrontOfPos(pos, angle, distance) {
|
||||||
|
let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance));
|
||||||
|
let y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
|
||||||
|
let z = pos.z;
|
||||||
|
|
||||||
|
return toVector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function getPosBehindPos(pos, angle, distance) {
|
||||||
|
let x = (pos.x+((Math.cos(angle-(Math.PI/2)))*distance));
|
||||||
|
let y = (pos.y+((Math.sin(angle-(Math.PI/2)))*distance));
|
||||||
|
let z = pos.z;
|
||||||
|
|
||||||
|
return toVector3(x,y,z);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function getPosAbovePos(pos, distance) {
|
||||||
|
return toVector3(pos.x, pos.y, pos.z+distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function getPosBelowPos(pos, distance) {
|
||||||
|
return toVector3(pos.x, pos.y, pos.z-distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
Reference in New Issue
Block a user