Can you specify better how you would like the leafs to behave, so they just move around from a global wind force or do you want the wind to be emitted from a source?? do you want to move the source? so on …
d) Here is one more idea
make a small circle or something, you can make it invisible.
This will be your “wind generator” when objects gets close to this, they will be repelled by a force from this wind object, which will be depend on the distance to the floating objects to be affected.
do something like this
local floatingobjects = {}
local function windforce()
for j=1,#floatingobjects do
-- get the distance to objects from the windgenerator
dx = windgenerator.x - floatingobjects[j].x
dy ......
dist = sqrt(dx^2+dy^2)
-- calculate the force which the floats will be affected by
force = factor/dist^2
get the directional force components
forceX = cos( atan2(dy,dx))\*force
forceY = sin( atain2(du,dx))\*force
-- apply the force/impulse to the objects
floatingobjects[j]:applyForce( forceX,ForceY)
end
end
Runtime:addEventListener( "enterFrame", windforce )
You can manipulate this as you wish, e.g make the force*math.ran(1,10) to make some wind blast or something…
[import]uid: 162464 topic_id: 30066 reply_id: 120391[/import]