Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. def CalcAngle(src, dst):
  2. angles = Vector3(0, 0, 0)
  3. delta = Vector3(src.x-dst.x, src.y-dst.y, src.z-dst.z)
  4. hyp = math.sqrt(delta.x*delta.x + delta.y*delta.y)
  5. angles.x = float( math.asin(delta.z/hyp) * float(180)/math.pi)
  6. angles.y = float( math.atan(delta.y/delta.x) * float(180)/math.pi)
  7. angles.z = float(0)
  8.  
  9. if delta.x >= float(0):angles.y += float(180)
  10.  
  11. return angles
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement