• Advertisement
Sign in to follow this  

Back and forth movement

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

Hey guys, How can i do back and forth movement? Like, let's say i there's a guy standing around and i want his head to move to 25 degrees, then -25 degrees, how would i do this? Thanks :) Mike

Share this post


Link to post
Share on other sites
Advertisement
That's a really vague question. How are you displaying the guy? What programming language are you using? How long do you want his head to be facing each direction? How long do you want it to take for the facing to change? Do you want the change to be abrubt or smooth?

Share this post


Link to post
Share on other sites
If you are talking about a keyframed back-and-forth motion (like a Pong ball), most of the time you can control this with two variables. One variable tracks the angle of the guy's head and the other determines the speed at which the head is turning/rotating.

Just initialize these variables outside the function where the movement takes place, and inside the movement funtion check whether the angle passes the 25 or -25 degree limit and reverse the variable for the rotation speed.

Share this post


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

  • Advertisement