Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Simple Question.

This topic is 5238 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok i just want to comfirm that i did this correctly. I am making a simulator for a missile launch. Anyways the Launch pad is located at 0m and the target is located 250m away and it is 170m high and flat and infinitly long. Now i want the missile to just display where it hits on the target (170m high, if it can fit on the screen or course). So this is what i did. I used for the x and y positions x = t*V*cos(alpha) y = t*V*sin(alpha) - (g*t^2)/2 t = ? V = 200 feet per second g = 9.81 alpha = 45 degrees * PI/180 (conversion to radians) Now i know what y is (170m) so to find x (impact point) i must solve the equation y = t*V*sin(alpha) - (g*t^2)/2 for t then substitute t into x = t*V*cos(alpha). (gt^2)/2 - t*V*sin(alpha) + y = 0 so i solve this using the quadratic equation (-b +- sqrt(b^2 - 4*a*c))/2*a where a = g/2 b = -(V*sin(alpha)) c = y to obtain the roots , which are the times in seconds where the missile is at h=170m (going up and coming down). So obviously the the greater root (t) is the impact point of t (where the projectile lands on the target). Oh and to solve the quadratic equation i divided a, b and c by a, just to make a = 1. ( i get a different answer if i don't ) Does this sound right? Im pretty sure it is, i just want to make sure. Oh an i coded this using Java, no openGL or anything, just simple GUI that will display the impacy point on the target (yeah i know it's kinda lame but thats what i am required to do). Thanks Stupid Everything!! [edited by - gimpy on March 18, 2004 1:35:07 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!