Xwad Posted January 28, 2016 Share Posted January 28, 2016 Hi i made a script that makes possible if a player rotate his camera then the weapon will rotate to the same direction. I have only one problem.. the weapon is only rotating to left and right. Its not rotating up and down:/ i mean, forexample if i rotate the camera to the right or to the left then the weapon will rotate to the same direction. But when i look up and down then the weapon is not rotating up and down. Pls help local test = createWeapon("m4", -2388.41,-581.15, 132.3)setWeaponState(test, "ready") function rotate () setElementRotation(test, 0, 3.2, 96.7 -getPedCameraRotation(localPlayer)) end addEventHandler ("onClientRender", root, rotate) function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or tend Link to comment
Tomas Posted January 28, 2016 Share Posted January 28, 2016 Hi i made a script that makes possible if a player rotate his camera then the weapon will rotate to the same direction. I have only one problem.. the weapon is only rotating to left and right. Its not rotating up and down:/ i mean, forexample if i rotate the camera to the right or to the left then the weapon will rotate to the same direction. But when i look up and down then the weapon is not rotating up and down. Pls help local test = createWeapon("m4", -2388.41,-581.15, 132.3)setWeaponState(test, "ready") function rotate () setElementRotation(test, 0, 3.2, 96.7 -getPedCameraRotation(localPlayer)) end addEventHandler ("onClientRender", root, rotate) function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or tend You're just rotating Z-axis, that's why it's moving to right and left only. Link to comment
Xwad Posted January 29, 2016 Author Share Posted January 29, 2016 And how can i fix that? Link to comment
tosfera Posted January 29, 2016 Share Posted January 29, 2016 also rotate the Z-axis, maybe even the Y-axis too. Link to comment
Xwad Posted January 29, 2016 Author Share Posted January 29, 2016 What? I dont understand it very well. What should i do now with y amd z axis? Link to comment
Xwad Posted January 29, 2016 Author Share Posted January 29, 2016 PLSSSS HELPP!!! THIS IS THE LAST THINK I NEED TO FINISH MY SCRIPT!!!!!!((((((((((( Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now