hi …

I’m using FPS Input controller.

when I Press Left button the player walk side to the left , I want to let the player turn (rotate) to the left instead of walk side .

is that possible ???


Yes, like nearly everything, it is possible. Have a go at modifying the script yourself. If you have difficulty, we’re here to help.

The First Person Controller script CharacterMotor.js is very complicated, and you will get nothing but headaches if you try to modify it.

You can start with the example script given in CharacterController.Move. It’s very simple and can be easily modified.

The script below is just a version of this example that I’ve modified to turn left and right. Read the Move example and compare to this script to learn what was modified. Try to modify the example script to do both things: turn left/right, and strafe when you press Shift, for example.

Attach this script to the First Person Controller, and disable its original scripts CharacterMotor and MouseLook in the Inspector. There’s a second MouseLook attached to the camera, but it only controls the camera movement.

var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var turnSpeed : float = 60;
var gravity : float = 20.0;

private var moveDirection : Vector3 = Vector3.zero;

function Update() {
    var controller : CharacterController = GetComponent(CharacterController);
    var turn: float = Input.GetAxis("Horizontal");
    transform.Rotate(0, turn * turnSpeed * Time.deltaTime, 0);
    if (controller.isGrounded) { // only move or jump if grounded
        moveDirection = transform.forward * Input.GetAxis("Vertical") * speed;
        if (Input.GetButton ("Jump")) {
            moveDirection.y = jumpSpeed;
    // Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;
    // Move the controller
    controller.Move(moveDirection * Time.deltaTime);