SHARE
TWEET

mm_position_tracker.lua

MrCheeze Nov 16th, 2019 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. goalpos_x = 2590.9775
  2. goalpos_z = -157.1325
  3.  
  4. while true do
  5.     link_x = mainmemory.readfloat(0x3FFDD4, true)
  6.     link_z = mainmemory.readfloat(0x3FFDDC, true)
  7.     link_angle = mainmemory.read_u16_be(0x3FFE6E) * 2 * math.pi / 0x10000
  8.    
  9.     x_dist = goalpos_x-link_x
  10.     z_dist = goalpos_z-link_z
  11.    
  12.     h = z_dist / math.cos(link_angle)
  13.    
  14.     x2 = z_dist*math.tan(link_angle) - x_dist
  15.    
  16.     forward_distance = h - (x2 * math.sin(link_angle))
  17.     right_distance = x2 * math.cos(link_angle)
  18.    
  19.     gui.text(0, 200, string.format("Forward: %f", forward_distance))
  20.     gui.text(0, 215, string.format("Right: %f", right_distance))
  21.    
  22.     emu.frameadvance()
  23. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top