Sign in to follow this  
Odiee

Projectile theory

Recommended Posts

Hello.

I I'm at the position in my project where I need to do projectile calculations (bullets, bombs etc.) for a dual stick shooter. (player shoots at the direction of mouse position)
Previously I was using the Bresenham's line algorithm for fast calculations of points from A to B. Where a would just draw pixels or some bitmap.
But as I'm now working in OpenGL and with floating points this is no longer an option. I figured I would need starting point A(x,y,z) and Direction point B.
And I would need to calculate all the points from A through B until timer ends or some other event (collision etc.) And put a bitmap at each point.
But this is where I'm stuck. I don't know what to use, or weather I'm even right on the theory part.

Is there someplace I could learn about this topic?

Share this post


Link to post
Share on other sites
Without taking air resistance into account, projectile trajectories follow parabolas.

You have the starting direction and speed, with that you create a vector with X and Y speed components. The X reamains constant and you apply the gravity acceleration to the Y.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this