# Keep current force applied based on Vector3.forward?

Hey, first post on here, I’m curious about how I would achieve this.
What I have setup currently is a cube that moves forwards, and rotates using addforce and addtorque. What I’d like to achieve is when there is a current force that’s applied to the game object (When a vertical inpuit is held) and the cube is then rotated; the force will continue on based on the front of the cube. Rather than just slide towards where the previous force was pushing to. Similar to how a car would move.

Excuse this rough drawing, but a visual representation may help convey the idea. The code I currently am using is this.

``````rb.AddForceAtPosition((Input.GetAxis("Vertical") * forwardForce * transform.forward), transform.position + addForceLocation, ForceMode.Force);
rb.AddRelativeTorque(Vector3.up * (Input.GetAxis("Horizontal") * turnForce), ForceMode.Force);
``````

Add a forward force when the vertical input is pressed, times by the desired force in a forward direction, in the root of the rigid body plus the offset.

Rotate torque on the Y axis, by the desired force times by the horizontal input

## Found a solution to this for anyone else that comes across this later on.Grip: 0, meaning no traction - 100 decent amount of traction.

``````public float grip = 100f;
Vector3 turningGrip = (Quaternion.Inverse(transform.rotation))* rb.velocity;
turningGrip.x = Mathf.Lerp(turningGrip.x, 0, Time.deltaTime * grip);
rb.velocity = transform.rotation * turningGrip;
``````