Throw an object with touch

Get help using Construct 2

Post » Wed Mar 14, 2012 4:14 pm

Hi,

I am stuck with this :

Drag and drop an object (sprite) with Physics (Gravity 0) > OK

When finger-mouse released, the object must slide depending on drag speed.

(Like a hockey puck thrown on ice ) ??

Anyone ?
B
5
S
1
Posts: 19
Reputation: 488

Post » Wed Mar 14, 2012 4:15 pm

I doubt, that drag and drop will translate to physic force....

did you take a look at the objects velocity during the drag. Is it != 0?!Weishaupt2012-03-14 16:16:57
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Mar 14, 2012 4:29 pm

The object velocity is == 0 during drag but I can calculate Delta.X and Delta.Y during the drag.
B
5
S
1
Posts: 19
Reputation: 488

Post » Wed Mar 14, 2012 4:42 pm

So what you have to find out is the velocity and the angle of the drag and set these values to the draged object on release....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Mar 14, 2012 4:53 pm

I did that but the trouble is I calculate the velocity everytick and as soon as I release, the velocity goes to 0 ....
B
5
S
1
Posts: 19
Reputation: 488

Post » Wed Mar 14, 2012 5:16 pm

cant you store the last calculate vel into a global variable so you could set it to the onject on release?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Mar 14, 2012 5:17 pm

OK, I found a solution, it must be tweaked :
http://dl.dropbox.com/u/12869621/Throwing_obj.capx


Weishaupt : Thx for helping
B
5
S
1
Posts: 19
Reputation: 488

Post » Wed Mar 14, 2012 5:31 pm

no sweat
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Dec 26, 2012 2:29 pm

What solution did you come up with? The capx doesn't work now.
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Wed Dec 26, 2012 2:35 pm

Ok I have an idea!

calculate the distance between the touch and release point
and also the time between and you can find out the speed.
If you know the speed you can calculate the normal velocity and acceleration.
Then you have to se the object acceleration to the acceleration you just found out.
B
15
S
3
G
2
Posts: 42
Reputation: 2,412

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests