Doninho Posted March 29, 2020 Share Posted March 29, 2020 (edited) function findRotation3D(x1,y1,x2,y2) local X = math.abs( x2 - x1 ) local Y = math.abs( y2 - y1 ) Rotm = math.deg( math.atan2( Y , X ) ) if ( x2 >= x1 ) and ( y2 > y1 ) then -- north-east Rotm = 90 - Rotm elseif ( x2 <= x1 ) and ( y2 > y1 ) then -- north-west Rotm = 270 + Rotm elseif ( x2 >= x1 ) and ( y2 <= y1 ) then -- south-east Rotm = 90 + Rotm elseif ( x2 < x1 ) and ( y2 <= y1 ) then -- south-west Rotm = 270 - Rotm end return (630-Rotm) end x, y, z = 1882.148, -1311.159, 14.5 function showArrowservente(thePlayer) if ( localPlayer ) then if ( localPlayer == getLocalPlayer() ) then local px, py, pz = getElementPosition(localPlayer) arrowservente = createObject(1318, px, py, pz) attachElements ( arrowservente, localPlayer ) setObjectScale ( arrowservente, 0.2) setElementCollisionsEnabled(arrowservente, false) addEventHandler("onClientPreRender", getRootElement (), rotArrowservente) end end end Edited March 29, 2020 by Doninho 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