How to: Artillery physics power and angle?

Get help using Construct 2

Post » Fri Dec 09, 2011 5:43 am

In terms of an artillery game what function / formula should I use to supply the "Impulse" and "Angle" for the 'Apply impulse at angle' function. Given that I know the distance between the launch point and the target?

Can I adjust the power and angle values to increase or decrease the projectiles flight time given a fixed horizontal distance? (Make the projectiles peak at higher or lower points in world space!)

So, what is the function that allows me to pass 'time' and 'distance' and have it return 'power' (impulse) and 'angle'?

Cheers
Juba.
B
7
S
1
G
2
Posts: 10
Reputation: 1,802

Post » Fri Dec 09, 2011 8:14 am

For angle, you have the system expression angle(x1,y1,x2,y2) which will return an angle.
As for a formula I'm not math savy enough to provide one.

I'd go for trial and error, trying to find a ratio between, like you said, time and distance.
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: 6,999
Reputation: 57,793

Post » Fri Dec 09, 2011 8:29 am

I am a bit mysitified, but This site looks like exactly what you want.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Dec 09, 2011 10:17 am

There's not, you don't even want to use physics for that kind of stuff.
If you have a start point and an end point you just want to calculate a curve.

Physic is usefull if you want a movement to be the consequence of environnemental factor (gravity, wind, friction) Thus you can't really predict movement, and you don't really want to.

The behavior you describe is really not physics driven.

Indeed what squid showed is a curve calculation you can use the bullet behavior and tweak angle/speed during movementYann2011-12-09 10:19:47
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Dec 10, 2011 12:12 am

Thanks guys.

I think ill have to post the game Im working on in c2 for you to see why I'm asking for a physics based solution. Its not a standard artillery game its an action side scrolling game. Ill post it eventually i

I was thinking about using curves instead. I guess as all games designers know its just smoking mirrors.
B
7
S
1
G
2
Posts: 10
Reputation: 1,802

Post » Sat Dec 10, 2011 3:29 am

Another questions gravity on earth is 9.8m/s^2 so say I I change the world gravity in C2 to 30 would that just mean 30.0m/s^2??
B
7
S
1
G
2
Posts: 10
Reputation: 1,802

Post » Sat Dec 10, 2011 5:52 am

I think 30px/s
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, NRABrazil, PixelatedTrip and 27 guests