i did not say this was perfect…
you can make a much more complex function:
you need the angle of the rotation of the object
local dx = x - obj.x
local dy = y - obj.y
local distance = sqrt(dx*dx + dy*dy)
//distance from center of object to the point
local ang1=atan2(dx,dy)
//angle of the point relational to the center of the object
local dist=cos(ang1-angobj)*obj.width/2
//this calculates distance from center of object to the margin on the line connecting the center to the point, angobj is the angle of rotation of the object
if distance-dist>0 return false else return true end
// if the distance from center of the object to the point is greater then the distance from center to the margin the point is outside of the object
be aware that this might not be complete…this function work for only for points situated on the right side of the center of object (i don’t have time right now to make this complete…i will try today o tomorrow to make the actual function that works on all situations) [import]uid: 57170 topic_id: 14836 reply_id: 55032[/import]