how to calculate forces ?

hey all,

http://img651.imageshack.us/i/examplelm.jpg/

what i want to do is, rotate the red line in the below picture and apply force with the rotated angle.

i did the rotation but i cant calculate it correctly to applyforce.

if player touches the red line and moves upwards there should be more force, but if player moves the finger out of the red line’s rotation angle that gives me wrong applyforce.

ok i ll give you some code.

[lua]local onTouch = function( event )
local t = event.target

local phase = event.phase

local x,y = t:localToContent( t.x - t.xOrigin, t.y - t.yOrigin )
local dx = event.x - x
local dy = event.y - y
local angle = math.atan2( dy, dx )

if “began” == phase then

display.getCurrentStage():setFocus( t )
t.isFocus = true
t.xStart = t.x
t.yStart = t.y
t.angleStart = angle
t.rotationStart = t.rotation

t:stopAtFrame(1)
elseif t.isFocus then
if “moved” == phase then

local pi = math.pi
local delta = (angle - t.angleStart)
delta = delta * 180 / pi
t.rotation = t.rotationStart + delta
–print("event.x: " … event.x … ", event.y: " … event.y … " , t.x: " … t.x … ", t.y: " … t.y)
elseif “ended” == phase or “cancelled” == phase then

display.getCurrentStage():setFocus( nil )
t.isFocus = false

local bulletObj = display.newImageRect(“media/bulletObj.png”, 30, 2)
bulletObj.x = t.x
bulletObj.y = t.y
bulletObj.rotation = t.rotation
physics.addBody(bulletObj, { isSensor=“true”, friction=5, density=5 })
gameGroup:insert( bulletObj)

local distanceBetween = mCeil(mSqrt( ((dy) ^ 2) + ((dx) ^ 2) ))
print(distanceBetween)

–this is where i got stuck
local xForce = (event.x - t.x) * 1.75
local yForce = (event.y - t.y) * 1.75

arrowObj:applyForce(xForce, yForce, arrowObj.x, arrowObj.y )
end
end
return true
end[/lua]
[import]uid: 22024 topic_id: 6470 reply_id: 306470[/import]