# Controls help please!

**URL:** https://discussions.unity.com/t/controls-help-please/26723
**Category:** Questions & Answers
**Created:** [August 12, 2011, 7:37pm UTC](https://discussions.unity.com/t/controls-help-please/26723 "2011-08-12T19:37:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/system/32/97283_2.png) [@system](https://discussions.unity.com/u/system)
#### Post date: [August 12, 2011, 7:37pm UTC](https://discussions.unity.com/t/controls-help-please/26723/1 "2011-08-12T19:37:48Z")

</div>

In unity, I made a project and I added in a sphere. My input settings are set to the defaults (up and down keys and w and s keys for forward and backward, left and right keys and a and d keys for left and right) and I added in a sphere to the game. I played the game and I tried all 8 keys but my sphere wouldn’t drop to the plane or move forward, backward, left, or right. I have a sphere collider on it and a character controller but it still wouldn’t work.

Can somebody please tell me what I’m doing wrong?

---

<div class="post-metadata">

### Author: ![aldonaletto](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/aldonaletto/32/44226_2.png) [@aldonaletto](https://discussions.unity.com/u/aldonaletto)
#### Post date: [August 12, 2011, 8:01pm UTC](https://discussions.unity.com/t/controls-help-please/26723/2 "2011-08-12T20:01:24Z")

</div>

You need to write a script to do the job, and drag this script to the sphere. A good example is given in [1](http://unity3d.com/support/documentation/ScriptReference/CharacterController.Move.html) - it includes gravity and jump (spacebar). The example script is:

```
var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;

private var moveDirection : Vector3 = Vector3.zero;

function Update() {
    var controller : CharacterController = GetComponent(CharacterController);
    if (controller.isGrounded) {
        // We are grounded, so recalculate
        // move direction directly from axes
        moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,
                                Input.GetAxis("Vertical"));
        moveDirection = transform.TransformDirection(moveDirection);
        moveDirection *= speed;
        
        if (Input.GetButton ("Jump")) {
            moveDirection.y = jumpSpeed;
        }
    }

    // Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;
    
    // Move the controller
    controller.Move(moveDirection * Time.deltaTime);
}
```
