Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- goalpos_x = 2590.9775
- goalpos_z = -157.1325
- while true do
- link_x = mainmemory.readfloat(0x3FFDD4, true)
- link_z = mainmemory.readfloat(0x3FFDDC, true)
- link_angle = mainmemory.read_u16_be(0x3FFE6E) * 2 * math.pi / 0x10000
- x_dist = goalpos_x-link_x
- z_dist = goalpos_z-link_z
- h = z_dist / math.cos(link_angle)
- x2 = z_dist*math.tan(link_angle) - x_dist
- forward_distance = h - (x2 * math.sin(link_angle))
- right_distance = x2 * math.cos(link_angle)
- gui.text(0, 200, string.format("Forward: %f", forward_distance))
- gui.text(0, 215, string.format("Right: %f", right_distance))
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement