Advertisement
alestane

Pitch toward point

Feb 18th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.27 KB | None | 0 0
  1. local function launchHook(event)
  2.     local _, gravityY, = physics.getGravity()
  3.     local deltaY = (math.abs(event.x - weight.x) / 20) * gravityY
  4.     weight:applyLinearImpulse(20, (event.y - deltaY) - weight.y, weight.x, weight.y)
  5. end
  6.  
  7. weight2:addEventListener('tap', launchHook)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement