Projectile Motion in 3D pt. II (SOLVED)
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement