# Using "AddForce" with a Character Controller

I’m making a 3D game in which I want the player to dash in the direction they are facing when I press a button. However, want to use a character controller rather than a rigidbody so I know I can’t just use AddForce. Does anyone know how I can create short dash for my player in the direction they are facing?

Here is my movement script if that is helpful:

``````public class PlayerController : MonoBehaviour
{
Vector3 velocity;
public float gravity = -25f;

public Transform groundCheck;
public float groundDistance = 0.25f;
bool isGrounded;

public float turnSmoothTime = 0.07f;
float turnSmoothVelocity;

void Update()
{
//Character Movement
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;

//Character Rotation
if (direction.magnitude >= 0.1f)
{
float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
transform.rotation = Quaternion.Euler(0f, angle, 0f);

Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
controller.Move(moveDir.normalized * movementSpeed * Time.deltaTime);
}

//Gravity
velocity.y += gravity * Time.deltaTime;
controller.Move(velocity * Time.deltaTime);

//Ground Check

if (isGrounded && velocity.y < 0)
{
velocity.y = -1f;
}
}
}
``````

I think I found something! I have this same exact issue. do you think this will help? Unity - Scripting API: CharacterController.Move

the only thing it can do is add force to character controller and simulate graviy. But i messed up drag, you basically need to add multiplication by Time.fixedDeltaTime onto drag and tweak a bit drag value. but its still works fine like it is now.

`````` public class CCRigidbody : MonoBehaviour
{

public bool isGrounded;

public bool lostControl;

public CharacterController characterController;

public float downAccel;

[Range(.95f, .99f)] public float drag = 0.97f;

[Range(.7f, .9f)] public float grondedDrag = 0.8f;

public Vector3 velocity;

public Vector3 gravity;

public Vector3 testForce;

float accelerationTime = 0.25f;

private Vector3 current;

private Vector3 velocitySmoothDampVel;

public float maxSpeedThreshold = 0.2f;

private CollisionFlags collisionFlags;

private CollisionFlags oldCollisionFlags;

private void FixedUpdate()

{

SimulateGravity();

current = Vector3.SmoothDamp(current, velocity + gravity, ref velocitySmoothDampVel, accelerationTime);

collisionFlags = characterController.Move(current * Time.fixedDeltaTime);

ApplyDrag();

CheckControlAbility();

CheckGround();

}

private void SimulateGravity()

{

gravity = isGrounded ? Vector3.down * 10f * Time.fixedDeltaTime : gravity + Vector3.down * 10f * Time.fixedDeltaTime;

}

private void CheckGround()

{

isGrounded = (oldCollisionFlags & CollisionFlags.CollidedBelow) != 0 || (collisionFlags & CollisionFlags.CollidedBelow) != 0;

oldCollisionFlags = collisionFlags;

}

private void ApplyDrag()

{

if (isGrounded)

velocity *= grondedDrag;

else

velocity *= drag;

}

{

this.velocity += velocity;

}

private void CheckControlAbility()

{

float speed = velocity.sqrMagnitude;

if (speed <= 0.01f) velocity = Vector3.zero;

lostControl = !isGrounded || speed > maxSpeedThreshold * maxSpeedThreshold;

}