Gordon_G Posted February 28, 2017 Posted February 28, 2017 Hello ! I'm trying to do a script, and I need to turn the player, to a point. I know it will be a mathematical function, I started like this but it's not working : function turn(source) local x,y,z = getElementPosition(source) local x1,y1,z1 = -2004.1025390625,146.181640625,27.5390625 local Player_A = getDistanceBetweenPoints2D(x,y,0,0) local A_point = getDistanceBetweenPoints2D(0,0,x1,y1) print(A_point) print(Player_A) local rot = math.deg(math.atan(Player_A/A_point)) print(rot) setElementRotation(source,0,0,rot) end addCommandHandler("turn",turn) Could someone help me ? Thanks ! Gordon#6977
Mr.Loki Posted February 28, 2017 Posted February 28, 2017 Use findRotation its a custom function so u need to add it to your code. [REL]Cinema Experience Beta 2.0 [TUT]Object offsets with OOP. [TUT] Adding a Discord bot to your server. Discord: Loki#7355
Gordon_G Posted March 1, 2017 Author Posted March 1, 2017 Oh thanks ! I didn't noticed it. Gordon#6977
Mr.Loki Posted March 1, 2017 Posted March 1, 2017 No prob, just reply here if you are still getting any difficulties with it. [REL]Cinema Experience Beta 2.0 [TUT]Object offsets with OOP. [TUT] Adding a Discord bot to your server. Discord: Loki#7355
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