Jump to content

Quick question


.:HyPeX:.

Recommended Posts

Posted

Hello, i got a quick question, if i want to go from a point to the north, whats the sum/rest of X,Y that im getting?

eg: going to the north by 1 point would represent an increase of X of 1 point. (0.5 if X/Y were made on 45° angles)

PD: I'm trying to get a rotation by X,Y Points as in my script the getElementRotation seems to not work.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

  • Moderators
Posted
function findRotation(x1,y1,x2,y2) 
  
  local t = -math.deg(math.atan2(x2-x1,y2-y1)) 
  if t < 0 then t = t + 360 end; 
  return t; 
  
end 
  
rot = findRotation(x,y, x + 0.5 ,y ) 

https://wiki.multitheftauto.com/wiki/FindRotation

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...