# How do I calculate the y distance dragged.

Get help using Construct 2

### » Sun Nov 27, 2016 8:09 am

Hi! Can anyone help me on this? I want to drag an object from a platform to a hight and calculate that high as the distance traveled when free falling from that hight to ground... I use a stopwatch for calculating the time and want to confirm the equation h=1/2gt^2
B
14
S
1
Posts: 68
Reputation: 785

### » Sun Nov 27, 2016 8:12 am

on drag start save the current Y (tempY)
on drag drop calculate (tempY - current Y)
B
43
S
22
G
15
Posts: 391
Reputation: 12,278

### » Sun Nov 27, 2016 9:49 am

Thank you but i don't meen that exactly. The distance i find with this calculation is not the distanse travelled on free fall (y=1/2gt^2). As you see h is different from y. I want them to be equal when object hits ground. I include the .capx file to help.

B
14
S
1
Posts: 68
Reputation: 785

### » Sun Nov 27, 2016 11:30 am

Sorry, i don't have the needed plugin...
You have to be more specific with your idea to understand your problem...
B
43
S
22
G
15
Posts: 391
Reputation: 12,278

### » Sun Nov 27, 2016 4:05 pm

I have an object on object.Y = 400. I drag that object to object.Y = 50. The distance is 350 ( I don't change the object.X). Then I drop the object and let it do a free fall to object.Y = 400 again. Based on constant timer (every tick add dt to timer) I calculate the fall distance as y=(1/2)*10*timer*timer. How can I match this distances?
B
14
S
1
Posts: 68
Reputation: 785

### » Sun Nov 27, 2016 5:39 pm

You are assuming you know the number that C2 actually uses for G. Doing an experiment to reverse engineer the number, comes up with a factor of 4.7 for your simulation. Also, your starting coordinate is not 470, the center of the sprite is 459, so that is your distance reference.
http://www.blackhornettechnologies.com/Construct2Stuff/freefall_BHT.capx
B
71
S
22
G
288
Posts: 3,858
Reputation: 158,422

### » Sun Nov 27, 2016 8:20 pm

Great!!! Thank you for your help!!!
B
14
S
1
Posts: 68
Reputation: 785