An animator dealing with code :)

Hi all,

I’m an animator with some web scripting experience recently converted to game coding thanks to Corona.

I’m still experimenting with a lot of the API and got stuck with one problem: how would you approach controlling an object not by dragging but “flicking it”? I have this rigid body object and I want the flick of my finger to push it away…

Thanks,

Gianmichele [import]uid: 12335 topic_id: 5059 reply_id: 305059[/import]

off the top of my head…

use the touch event, check the time on the “began” phase, determine the speed at which it hits your object by measuring the distance and time at your point of collision, then apply a relative force based on this speed with something like this: http://developer.anscamobile.com/reference/index/bodyapplyforce

j [import]uid: 6645 topic_id: 5059 reply_id: 16597[/import]

Thanks! Worked like a charm…

I’ve got basics of what I want to do. Any idea how to check if my touch, once moved is going to collide (intersect) another object?

[import]uid: 12335 topic_id: 5059 reply_id: 16744[/import]

in advance of it actually happening? [import]uid: 6645 topic_id: 5059 reply_id: 17003[/import]

This is what the gesture needs to be:

I can start my touch session anywhere on the screen. From the starting point to where my touch ends, I want to calculate if that line is intersecting any object.

Man, I should have really paid more attention to math back in school eheheh [import]uid: 12335 topic_id: 5059 reply_id: 17057[/import]