Sign in to follow this  
Beaverbutt8

Back and forth movement

Recommended Posts

Beaverbutt8    100
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
SiCrane    11839
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
Just Chris    142
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this