[How do i] Math for Artillery

Get help using Construct 2

Post » Mon Aug 05, 2013 2:12 pm

Hello,
im not that good at math, and construct 2.
And now i want to simulate an artillery.
First, i need to simulate the angle the barrel is at.
Second, i need the correct gravity and acceleration.

If i have those two factors it should work out.
I have something like enemy.X - (enemy.x/2) (repeat the same for y)
in the head for the angle of the barrel.
but since not every shot is landing correct, this isnt working out.
How should i handle these two factors so i could simulate an artillery?SgtConti2013-08-05 17:43:21
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
10
G
7
Posts: 253
Reputation: 4,896

Post » Mon Aug 05, 2013 7:03 pm

Anyone know?
really frustrating ...
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
10
G
7
Posts: 253
Reputation: 4,896

Post » Mon Aug 05, 2013 7:22 pm

You're not very clear. Do you want a formula for hitting a specific target? Or do you just want your artillery to shoot properly?
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,669

Post » Mon Aug 05, 2013 7:33 pm

i want it to hit a specific target,
better said, to hit a specific X,Y Point.
and the problem is setting the barrel of the Artillery unit in the right angle to do this.
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
10
G
7
Posts: 253
Reputation: 4,896

Post » Tue Aug 06, 2013 5:51 am

I recommend to read this page about trajectories:

http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html

It can be little hard to understand at first, but this page really helped me to do trajectory calculations for 3d space.
B
39
S
14
G
9
Posts: 151
Reputation: 8,632

Post » Tue Aug 06, 2013 2:52 pm

Sry but im not that good at vector, i cant even make tests how far the projectile would fly, i tried:
if Projectile.Y = Barrel.Y , then set global variable Distance to Projectile.Y - Barrel.Y
But that wont work, i dunno why...
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
10
G
7
Posts: 253
Reputation: 4,896

Post » Tue Aug 06, 2013 2:59 pm

So when the y-coordinate of the projectile is the same as the y-coordinate of the barrel set the global variable to 0(if they are both the same deducting them will always be 0)?

I don't think this is what you are trying to do. But this is what you are doing.

Now the question is what are you trying to do?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Aug 06, 2013 3:03 pm

oh sry i meant Proctile.X - Barrel.X
i tried to figure out how far away the bullet would fly so i could calculate the ca. Angle of the barrel if the enemy would be that far away.
this was my second option.
But of course i stould would love to calculate the Angle ingame without having it pre-defined.
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
10
G
7
Posts: 253
Reputation: 4,896

Post » Tue Aug 06, 2013 3:29 pm


Link from the FAQLittleStain2013-08-06 15:31:12
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Aug 06, 2013 6:12 pm

good link, but i dont understand a thing in that CapX, i only want the end destination, i dont care about how it flies, just where it lands.
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
23
S
10
G
7
Posts: 253
Reputation: 4,896

Next

Return to How do I....?

Who is online

Users browsing this forum: pynam and 5 guests