• Advertisement

Archived

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

Tangential velocity

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

I'm working a C++ game where two spaceships duel. I want to modify the targeting computer's accuracy by the opposing ship's rotational velocity. To do that, I need to find the tangential component of the relative velocity of the enemy ship. I have four variables to work with, the relative velocity and displacement, each in x and y components. A diagram http://www26.brinkster.com/ltgroup/problem.jpg Just for clarification, px and py are the relative displacements, and vx and vy are the relative velocities. The displacements form angle theta and the velocities form the angle phi . The orange triangle represents the tangential and radial components of the enemy ship's velocity. I could finish this if I knew how to calculate the angle they form. And use either radians or degrees, just be consistent and give me a heads-up if you can answer my question. Thanks! [edited by - bartkusa on May 29, 2002 7:39:07 PM]

Share this post


Link to post
Share on other sites
Advertisement
Take p to be the unit vector in the direction of the displacement of the enemy from the targeting ship, so this has components px/length(p ) and py/length(p ).

In other words,


p = (pxi + pyj )
---------------
sqrt(px2 + py2)


where i and j are the vector basis aligned with your cartesian axes.

Given p you can take the vector projection of the enemies velocity vector - which we can call V - onto p , where


V = vxi + vyj


giving


projp V = (V.p )p

= (vxpx + vypy)
--------------- p
sqrt(px2 + py2)


Now, this gives the radial component of the enemies velocity relative to the targeting ship. The tangential velocity is therefore


V - projp V


Good luck!

Timkin

[edited by - Timkin on May 29, 2002 12:02:51 AM]

Share this post


Link to post
Share on other sites
Sweet! It works like a charm! Our high school doesn''t really emphasize matrices or vectors like that. Vectors are a necessity for physics, but we work more with trig and:

A.B = ABcos(theta)

than otherwise.


Thanks a ton, Timkin!

Share this post


Link to post
Share on other sites

  • Advertisement