@bubblebobble,
Unfortunately there isn’t a much easier way if you want it to look/work accurately.
I would approach it similarly, but just slightly differently, to the other suggestions. Put a circular “range” sensor around the dryer. When the feather enters this sensor, start a Runtime listener that checks each frame and compares the location of the feather and the dryer. Get both the X and Y difference between them. You won’t need to do any fancy vector/angle trigonometry, since the applyForce() function takes linear values as its parameters… thus, you only need the linear differences. Then, apply an inverse force to the feather based on these values, adjusted to a very small fraction because applyForce() can be VERY strong and blow an object into the 5th dimension if you’re not careful! Finally, when the feather exits the sensor range, stop the Runtime listener.
For example, let’s assume the feather falls directly down on the dryer, located at coordinates 0,200. When it hits the sensor, the feather might be at 0,-100. Subtract the respective values and then negate to get “inverse” forces of 0,-300.
(fanY - featherY) * -1 = opposing force
Now, the feather is far away at this point so you need to “flip” this value by dividing 1 by it.
1/-300 = -0.0033333333.
Simply apply this force to your feather for the Y force parameter! Again, you might need to adjust this even further, by a factor higher or lower, depending on your physics setup, gravity, etc.
Presumably the feather will continue falling a bit. No problem. Let’s say it reaches 0,-50. Dryer remains at 0,200. The formula yields -250 in this case. 1/-250 = -0.004. As you can see, the result is a stronger opposing force as the feather gets nearer. If it somehow gets down to 0,180, that’s just a difference of 20, and the end result is -0.05… considerably higher than our previous values of 0.004 and 0.003333.
Obviously this will work for the X calculations too.
And, for setting up collision filters so that the dryer sensor only reacts with the feather, please refer to my helper chart here:
http://developer.coronalabs.com/forum/2010/10/25/collision-filters-helper-chart
Hope this helps!
Brent Sorrentino
[import]uid: 9747 topic_id: 29835 reply_id: 119847[/import]