Adding force relative to player's rotation with rigidbody.velocity

Hey there !

I’m currently creating a character controller and I’m trying to make it so the player can do a full loop. I have ground alignment set up and working, but the force isn’t being added relative to the player’s rotation.

Here’s a snippet of the code i’m using to add force.

void AddForce(Vector3 direction, float force)
{
        rigidbody.velocity = (direction * force) + rigidbody.velocity
}

// Direction is the direction that the force is being added to (ex. direction of the joystick)
// Force is the amount of force being added

How can i make it so it adds force to the player relative to his rotation, with rigidbody.velocity ?

Hello, Your function AddForce already exist in Rigidbody and you have the AddForceAtPosition that take count of rotation :slight_smile: Read more at Unity - Scripting API: Rigidbody
Hope that help ! Raph