Jump to content
  • Advertisement
Sign in to follow this  
soupyhands

velocity constraints on cubic bezier

This topic is 2084 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 trying to figure out how to include velocity constraints to a flight game.

I have a satellite background image that ranges from longitudeA to longitudeB (in cartesian) along x axis and latitudeA to latitudeB along y axis. I then have an airplane at Point 0 (lat0 and lon0) with velocity of 50 knots. The player then clicks to add Point 3 (lat3, lon3) with a direction and velocity using an arrow. I'm trying to figure out how to construct a bezier with these velocity constraints. Using this image as a reference (http://upload.wikimedia.org/wikipedia/commons/c/c1/Bezier_3_big.png), I'm trying to figure out how far to put P1 from P0 and P2 from P3 given the desired velocity at P3. I know the length between P2 and P3 will be longer if velocity is higher, but I don't know how to get an exact number.

So far, I can get everything but the velocity to work. I can generate a cubic bezier that's tangent to the current airplane direction and tangent to desired direction at point 3. I can't figure out how to add in the velocities. Am I missing something as simple as unit conversion?

Share this post


Link to post
Share on other sites
Advertisement

The derivatives of a cubic Bézier curve at the endpoints are 3(P_1 - P_0) and 3(P_3 - P_2). You thus have to set P_1 = P_0 + v_i/3 and P_2 = P_3 - v_f/3.

Edited by apatriarca

Share this post


Link to post
Share on other sites
 

The derivatives of a cubic Bézier curve at the endpoints are 3(P_1 - P_0) and 3\,(P_3 - P_2). You thus have to set P_1 = P_0 + v_i/3 and P_2 = P_3 - v_f/3.

 

Thanks for the response. The problem I was running into was units. Since the airplane location is a lat/long (in degrees), I don't know what units I my v_i and v_f be. Are the units going to be degrees/second, degrees/min, knots?

To simplify, if the location was a point (x,y) in meters, would my velocity be meters/second?

Share this post


Link to post
Share on other sites
If you are using seconds as your time unit and meters as your position unit, then it would be [m/s]. Otherwise it would be "your position unit"/"your time unit here". But it looks like you are using a spherical coordinate system (lat/long/altitude) to define your airplane position, but a different method to define your velocity. Can you clarify the math behind the following step "The player then clicks to add Point 3 (lat3, lon3) with a direction and velocity using an arrow."?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!