Sign in to follow this  

Projectile Motion in 3D pt. II (SOLVED)

This topic is 3590 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

Just so everyone knows, i'm not opposed to completely changing everything about the way I'm doing this. I would much rather use vector math to do this but I just don't know how to implement it. If you can explain it (articles, wikipedia, yourself, books i should read), I'll take it. I'll take all the advice I can get, I really want to get this working. I can't get the darn projectiles to work how I like. When I rotate to far left or right the y positions of my bullets don't appear to go high enough. They actuallay are, but x is scaled when I rotate and the bullets go faster in the x direction making the y direction appear to be shorter than the angle at which they should be firing. I could really use some suggestions as to how to do this the right way. I'd like to eventually implement guided missiles etc, but that should be easier by magnitudes once I get this part down. I will describe what I'm doing so that you can get a better picture of what I'm trying to achieve. I created what I believe is called an arcball camera. This has a rotation value and an arc value. I then load a canon barrel. This inheirits it's rotation from the cameras rotation and arc values. If i rotate the camera to view left, the canon rotates counter clockwise etc. I also have a projectile class which stores values about it's position for now, nothing fancy. As you can see a lot is dependant on the camera. I create a new projectile everytime the left mouse button is clicked. Each new projectile is stored in a list to make rendering them easier. When I draw the projectile I do the following. I translate it to the tip of the canon barrel, using an origin vector that the projectile class contains. I then rotate the projectile to always face the camera, (it's a billboard), I then translate it to the position currently stored in the projectile.Position vector. The problem I'm having is the following. The projectile moves exactly the way I want on the x axis when I rotate the camera left or right. However as I rotate left or right away from the center (looking directly down Z is center) the x values scales up and the y value is distorted somehow, or so it seems anyway. So the result is that when looking left or right it looks as though I can't shoot as high as when looking dead center. [Edited by - CharlieR on February 17, 2008 7:48:02 AM]

Share this post


Link to post
Share on other sites
Well I solved this and then some...

It works perfectly now. Absolutely perfect.

Any how, on to the next part of my project. Skybox & Collision detection for
projectiles.

Share this post


Link to post
Share on other sites

This topic is 3590 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.

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