# Throw an object with touch

Get help using Construct 2

### » 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

### » 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
44
S
24
G
13
Posts: 723
Reputation: 15,105

### » 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

### » 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
44
S
24
G
13
Posts: 723
Reputation: 15,105

### » 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

### » 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
44
S
24
G
13
Posts: 723
Reputation: 15,105

### » 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

### » Wed Mar 14, 2012 5:31 pm

no sweat
B
44
S
24
G
13
Posts: 723
Reputation: 15,105

### » Wed Dec 26, 2012 2:29 pm

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

### » 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