# Calculating where a projectile under the influence of gravity and drag will land...

Discussion in 'Game Design' started by Genkidevelopment, Feb 20, 2015.

Not open for further replies.
1. ### Genkidevelopment

Joined:
Jan 2, 2015
Posts:
186
Firstly, apologies if this has been placed in the wrong section, I have considered putting this in the scripting forum, but strictly, code isn't involved yet, I feel this is more a design feature...

I am firing a projectile into the air. Each 'fire' will have a different 3D velocity... I need to estimate where the projectile will land...

My thoughts on a possible way to do this...

1) upon 'fire', a function will return a vector 3 representing the point at which the projectile will land...

2) To do this, it will register the Vector3 at which it is fired and store it...

3) The next frame, we will again measure the Vector3 of the projectile... and calculate how much it has moved by means of the difference... Using this 'Difference Vector3' we can estimate where it will land...

4) We will need a formula to place this 'Difference Vector3' into...

Thoughts? It might be better to use a bigger time-gap for the difference?

Anyone had any success with this sort of thing? Or know a good resource to learn about it?

Thanks all

2. ### JoeStrout

Joined:
Jan 14, 2011
Posts:
8,880
Nope. That's a scripting question, not a design question.

Related design questions would be things like:
• How does firing a projectile into the air impact the game play?
• Should I show players where the projectile is going to land while they are aiming?
• Would the game be more/less fun if you had to fire two projectiles at once?
• Should my projectile-firing game be turn-based or real-time?
• What design lessons can we learn from great projectile-firing games of the past?
But as soon as you've decided what you want to do, and you're wondering how to do it, that's no longer a design question.

Had you posted in the Scripting forum, I would point out that what you're describing is classic Euler integration, and that you might want to start with this article about it. But since this is the Design forum, I won't.

3. ### Genkidevelopment

Joined:
Jan 2, 2015
Posts:
186
Hey! Thanks for the reply and advice, I shall know better for future posts...

And also, thanks for not giving me help with my problem!

4. ### Genkidevelopment

Joined:
Jan 2, 2015
Posts:
186
So it boils down to knowing the initial velocity and angle of the projection... from there on in it's A level physics

JoeStrout likes this.
5. ### Ryiah

Joined:
Oct 11, 2012
Posts:
15,959
If we helped every single person who didn't post in the correct section, many would never post in the correct section.

AndrewGrayGames likes this.
6. ### AndrewGrayGames

Joined:
Nov 19, 2009
Posts:
3,823
We also wouldn't give them jellybeans. Like these jellybeans. They were pooped by the Easter Bunny.

TL;DR - Every time a newbie posts a question in the wrong place and you help them, you're feeding them jellybeans pooped by the Easter Bunny. Don't feed newbies jellybeans pooped by the Easter Bunny!

Ryiah likes this.
7. ### Genkidevelopment

Joined:
Jan 2, 2015
Posts:
186
Well, that's not really fair!!! Now I am drooling for that delicious looking candy!

Oh!!! - Or you could just say "this is in the wrong section, things that belong in this section are....." you know, if it really grinds you that much

Thanks

Peace

AndrewGrayGames likes this.
8. ### AndrewGrayGames

Joined:
Nov 19, 2009
Posts:
3,823
Eh, no biggie. Now you know! Good luck.

Genkidevelopment likes this.

Joined:
Jun 27, 2007
Posts:
5,670
This belongs in a different section.

There is a description in the stickies about what is appropriate for this thread.

- but -

Cummon guys, the comments are bordering on proto-trolling.

Let's be polite.

0tacun likes this.