- Home /
Question by
Matt 26 · Mar 19, 2011 at 06:33 PM ·
objects-movement
How to have a character move on its own?
I want to have my character to move right the whole time, and the player only has the option to move up and down. What is the best way to go about having the character move on its own, I have this code for the up and down movement.
var speed : float = 10.0;
function Update() {
vertMovement = Input.GetAxis("Vertical");
if (vertMovement) {
transform.Translate(transform.up * vertMovement * Time.deltaTime * speed);
}
}
Comment
I think we'll need more specifics on what you want to do. you could update the player position by speed*deltaTime*Vector3.right but this will shoot him off into infinity. Unless that's what you want.