Drop objects in a curved path

I was trying out the Many Crates example given by corona, well I was able to replicate it. We use the gravity to drop the physics bodies in a straight line, but I was thinking that can we drop the objects in a curved path. Like in a S curve sort of a thing. Is this possible, please let me know [import]uid: 183447 topic_id: 33444 reply_id: 333444[/import]

Hello,
You can drop the crates in any ordered list of coordinate-pairs, if you calculate the list values first. If the “s” curve will be the same each time, you can manually plot some points and use those as your “pattern”. If you need a variable curve each time, you’ll need to research the advanced math formulas to calculate the curves and provide you with a list of coordinate-pairs.

Best regards,
Brent [import]uid: 200026 topic_id: 33444 reply_id: 132883[/import]

Where can I find detailed info on the above solution. It would be good if there is an example as well :slight_smile: [import]uid: 183447 topic_id: 33444 reply_id: 132892[/import]

Hello again,
How are you dropping the objects on the straight line currently? Can you show me that piece of code so I can suggest a method to apply something similar to a curve?

Thanks!
Brent [import]uid: 200026 topic_id: 33444 reply_id: 132940[/import]

I would create a bezier curve and use Carlos’ follow an object along a path code http://www.carlosicaza.com/?s=along+a+path - I would then retrieve the x,y values of the curve adjusting the granularity of the t parameter to your liking. Once you are satisfied, you can then “drop” your crate to the series of x’,y’ defined by the parameter value. Notice that the curvature of the curve, as described in Carlos’ blog, will yield different parameter values as t is not evenly spaced and it will yield different speeds along the curve’s curvature, so keep that in mind.

Another approach would be to plot the points of a half a circle given traditional trigonometry formulas such as that of sin,cos using an origin at x,y and a radius of r you can calculate the points given a t value.

Peach :slight_smile: [import]uid: 52491 topic_id: 33444 reply_id: 132980[/import]

Hello,
You can drop the crates in any ordered list of coordinate-pairs, if you calculate the list values first. If the “s” curve will be the same each time, you can manually plot some points and use those as your “pattern”. If you need a variable curve each time, you’ll need to research the advanced math formulas to calculate the curves and provide you with a list of coordinate-pairs.

Best regards,
Brent [import]uid: 200026 topic_id: 33444 reply_id: 132883[/import]

Where can I find detailed info on the above solution. It would be good if there is an example as well :slight_smile: [import]uid: 183447 topic_id: 33444 reply_id: 132892[/import]

Hello again,
How are you dropping the objects on the straight line currently? Can you show me that piece of code so I can suggest a method to apply something similar to a curve?

Thanks!
Brent [import]uid: 200026 topic_id: 33444 reply_id: 132940[/import]

I would create a bezier curve and use Carlos’ follow an object along a path code http://www.carlosicaza.com/?s=along+a+path - I would then retrieve the x,y values of the curve adjusting the granularity of the t parameter to your liking. Once you are satisfied, you can then “drop” your crate to the series of x’,y’ defined by the parameter value. Notice that the curvature of the curve, as described in Carlos’ blog, will yield different parameter values as t is not evenly spaced and it will yield different speeds along the curve’s curvature, so keep that in mind.

Another approach would be to plot the points of a half a circle given traditional trigonometry formulas such as that of sin,cos using an origin at x,y and a radius of r you can calculate the points given a t value.

Peach :slight_smile: [import]uid: 52491 topic_id: 33444 reply_id: 132980[/import]