Jump to content
  • Advertisement
Sign in to follow this  
webjeff

3D Arc Equation or Function

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

Hello guys, OK, I did some research but all I could find was 2d arc equations. I need a 3d arc, like if I were to throw a ball to a location with a supplied force. Does anyone have any way to do this or is there a built in DirectX function that helps? Thanks Guys. Jeff.

Share this post


Link to post
Share on other sites
Advertisement
i dont know what equation you have but couldn't you just convert this into one with a 3D vector instead of a 2D one. Just one more component to keep track of.

btw try the math & physics forum

Share this post


Link to post
Share on other sites
This can get pretty difficult depending on how much of a range of motion your projectile will have. In the simplest case 3D projectile motion is the same as 2D projectile motions, you simply "lock" or ignore one of the planes.

If you define you coordinate system like so:

y
/|\ / Z
| /
| /
|/_______\
/
x

y(t) = 1/2at2 + vsinθt + y(0)
x(t) = vcos(θ)t + x(0)
z{t} = 0

Here you see I have set the motion in the z plane as zero, in the x plane there can be such factors as wind and in the y plane there is gravity. How you define the vector v is up to you. If you wish for a projectile that can basically waggle in all 3 dimensions then you can either define your vector in terms of 2 angles or explicitly operate on each vector component.

In 3D the motion vector r is described by r = xx + yy + zz , where x, y and z are unit vectors and x, y and z are functions which describe the motion in their respective coordinates. If you have that dx/dt = axt  + vx0 then you will have your change in position in the x dimension. This can be extended to the other dimensions dy/dt = ayt + vy0 and dz/dt = azt + vz0.



(Note that this implies that the change in motion in general will be the sum of the change of motion in each coordinate:  dr/dt = dx/dtx + dy/dty +  dz/dtz).  If you take a step back and define everything in terms of vectors you compactify the operation and everything becomes simpler. r = r0 + dr/dt = r0at + v0 . How you fill each of the vectors (I will define them as [x y z]) is up to you. If you have a =  [0 9.8 0], v = [0 0 0] and r0 = [0 0 0] then you will have standard projectile motion. Making v = [4 0 0] will give a velocity in the x direction.  One can easily incorporate momentum and Force for calculations of velocities and accelerations.

[Edited by - Daerax on August 17, 2004 9:57:27 PM]

Share this post


Link to post
Share on other sites
A few corrections and an optional method. I just realized I had r0 instead of r in the equation of motion. It should be r = r + dr/dt = rat + v0. Also if we integrate we can work back to the famous projectile motion equation dr = r = 1/2at2 + v0t + r0.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!