Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Suggest a change
SimpleMove(speed: Vector3): bool;
bool SimpleMove(Vector3 speed);
def SimpleMove(speed as Vector3) as bool


Moves the character with speed.

Velocity along the y-axis is ignored. Speed is in meters/s. Gravity is automatically applied. Returns if the character is grounded. It is recommended that you make only one call to Move or SimpleMove per frame.

	var speed : float = 3.0;
	var rotateSpeed : float = 3.0;

function Update () { var controller : CharacterController = GetComponent(CharacterController);

// Rotate around y - axis transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0); // Move forward / backward var forward : Vector3 = transform.TransformDirection(Vector3.forward); var curSpeed : float = speed * Input.GetAxis ("Vertical"); controller.SimpleMove(forward * curSpeed); }

@script RequireComponent(CharacterController)
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public float speed = 3.0F;
    public float rotateSpeed = 3.0F;
    void Update() {
        CharacterController controller = GetComponent<CharacterController>();
        transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed, 0);
        Vector3 forward = transform.TransformDirection(Vector3.forward);
        float curSpeed = speed * Input.GetAxis("Vertical");
        controller.SimpleMove(forward * curSpeed);
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public speed as float = 3.0F

	public rotateSpeed as float = 3.0F

	def Update() as void:
		controller as CharacterController = GetComponent[of CharacterController]()
		transform.Rotate(0, (Input.GetAxis('Horizontal') * rotateSpeed), 0)
		forward as Vector3 = transform.TransformDirection(Vector3.forward)
		curSpeed as float = (speed * Input.GetAxis('Vertical'))
		controller.SimpleMove((forward * curSpeed))

Your name (optional):
Your email (optional):
Please write your suggestion here: