# Projectile Motion in 3D pt. II (SOLVED)

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

## 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 on other sites
--- Removed Code Listing ---

[Edited by - CharlieR on February 17, 2008 7:58:37 AM]

##### 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 on other sites
"Collision detection for projectiles."

Have fun! :o
I'd really advocate the use of a 3rd party solution here! I use ColDet for all my projectile collision needs.

1. 1
Rutin
31
2. 2
3. 3
4. 4
5. 5

• 13
• 52
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632967
• Total Posts
3009552
• ### Who's Online (See full list)

There are no registered users currently online

×