Jump to content
  • Advertisement

Archived

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

lpsoftware

bezier curves

This topic is 6921 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 everyone, In my game, the player will be occasionally firing off rockets at the enemy, and instead of making the rockets move in straight or diagonal lines (pretty boring), I want to make them move in "tracking curves" so they sweep out and nail the target. I believe what I need to do is implement bezier curves/splines into the rocket coordinate system. Is this correct? If so, where can I find more information on implimenting bezier curves, and if I''m wrong, well, tell me what''s right! Thanks, Martin

Share this post


Link to post
Share on other sites
Advertisement
I''m not sure if this was what you are looking for but if you take into account that the rocket is moving at a certain speed and can turn only a certain amount, then update the rocket''s orientation to re-aim it at the target and it will track in a smooth curve. If the target is stationary and the rocket is launched in a direction not directly at the target it will still turn in a curve toward the target.

Share this post


Link to post
Share on other sites
I had a pretty sweet homing missile in my last game. I don''t think you need to do bezier curves/splines to simulate one.

What I did was give my missile an initial direction and velocity (same direction as the player''s vehicle and a little faster). The direction here is the direction that the missile is *pointing*, which is not necessarily the direction it is moving.

Every frame, I turn the missile towards the target if necessary, and then accelerate the missile in it''s current direction. Lemme'' know if you wanna see some code for this.

Share this post


Link to post
Share on other sites
Here''s a tutorial about them: http://members.xoom.com/3dcoding/curves/index.html
Have fun!

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown

Share this post


Link to post
Share on other sites
Thanks everyone for replying. I guess I''ll take the advice and not use bezier curves/splines because they look a little challenging I guess I''ll just do it like this: When the player shoots a missile, the missile sprite will be displayed perpendicularly (is that a word?) and then be adjusted depending on the enemy position, which will be moving its coordinates.

By the way, anyone know where I can find some good-looking rocket art? Probably not. I''m a terrible artist

Thanks again,
Martin

Share this post


Link to post
Share on other sites
Look for the light sourced stretchy bouncy fun page. Something like that. They have a really cool pseudo code sample of bezier curves. I got a 2d bezier curve working in about 20 min.

Share this post


Link to post
Share on other sites

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