Sign in to follow this  
kessie

Geting front of player cords

Recommended Posts

Posted (edited)

Hi all,

I'm having a bit of the issue with getting front of player cords. When I run the scrip the angle seems to be random....

let x = mp.players.local.position.x;
let y = mp.players.local.position.y;
let z = mp.players.local.position.z;
let nx = x + (1.2 * Math.sin(mp.players.local.getHeading() + 180));
let ny = y + (1.2 * Math.cos(mp.players.local.getHeading() + 180));
let sadsad = mp.cameras.new("authCam", new mp.Vector3(nx, ny, z + 0.7), new mp.Vector3(0, 0, 0), 40);
sadsad.pointAtCoord(x, y, z + 0.7);
sadsad.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);

 

Edited by kessie

Share this post


Link to post
Share on other sites

Nevermind... sorted. Had to convert angle to radians... lul

let radians = -mp.players.local.getHeading()*Math.PI/180;
    let nx = x + (1.2 * Math.sin(radians));
    let ny = y + (1.2 * Math.cos(radians));

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.