Simple ballistics problem (SOLVED)

Get help using Construct 2

Post » Tue Feb 14, 2012 5:25 pm

I don't get what I'm doing wrong here. It seems like a simple equation. Given time t, starting y0, ending y1, and gravity g, find the initial y velocity vy0 such that y1 is the apex (vy should be 0 at this point in time).

Starting with basic movement equation:
y = y0 + (vy0 * t) + (0.5 * g * t)

--> (vy0 * t) = y - y0 - (0.5 * gt)
--> vy0 = [ (y - y0 - (0.5 * gt) ] / t

I then set the bullet behavior angle to 270 degrees, and the speed to the absolute value of vy0, and the gravity to g. But it travels way past the point which I had intended to be the apex of the curve.

Here is the code:


Here is the capx:
Ballistics Capx

What am I missing?

-- cacotigoncacotigon2012-02-16 21:02:37
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Thu Feb 16, 2012 8:47 pm

Nevermind, I figured out what I did, the equation should be:
vy = vy0 + gt
vy = 0 at apex, solve for vy0
vy0 = -gt
Substitute vy0 into standard physics distance equation:
y = y0 + vy0*t + 0.5gt^2
becomes:
y - y0 = -gt^2 + 0.5gt^2
sqrt((y - y0) / 0.5g) = t
vy0 = -g * sqrt((y - y0) / 0.5g)

Ballistics works fine now.

Here is a capx to demonstrate if anybody is interested:
Working ballistics sample

Maybe it can help other people.

EDIT: P.S., Do the forums support unicode? It replaced my square root symbols (unicode symbol U+221A) with question marks.cacotigon2012-02-16 20:49:12
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Thu Feb 16, 2012 9:40 pm

@Tom could answer the question about unicode format.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 23 guests