Jump to content
  • Advertisement

Archived

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

xwtiko

sine curve motion

This topic is 5321 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! I need some help in a program am making. I want to fix a carousel - you know the kids game with the horses going up and down. My problem is how am I suposed to make the horses move like a sine curve. In the code I''ve writen so far z is the vertical axis ,x tha horizontal kai y the one with direction from me to the screen. Something like that. ^ z | __ y | /| | / | / |/ ------------|---------> x /| / | / |

Share this post


Link to post
Share on other sites
Advertisement
What about using sin :

horse.z+=sin(time)*sine_amplitude;

If you think it goes too fast, make it time/2.0 of some other value, * for a faster movement.

Share this post


Link to post
Share on other sites
why do you use "+="? its simply "="
oh i got it but its quite minsunderstandable.
the horse's z position is:
defaultposition.z+offset, where offset is the horse.z value that Tree Penguin wrote

[edited by - orbano on January 23, 2004 4:25:18 PM]

Share this post


Link to post
Share on other sites
Just a hint:

When using ascii art use use a [ code] before and a [ /code] after. (Don''t include the space after the bracket)

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.

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!