Character Controller

I have a character controller, and I wan’t it to launch in the direction of the camera, kinda like “Rigidbody.AddForce” but, I can’t use a rigid body controller, because it stops the forward movement… :frowning:

So, is there any way I could do this with the character controller, that comes with unity? :slight_smile:

use its SimpleMove function. You need to add a Vector3 that indicates the direction and the speed as well.
Here is the Unity’s example script:

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);