how can i addforce to the opposite direction after using this:
rigidbody_.AddForce(direction.normalized * force * Time.deltaTime, ForceMode.Force);
rigidbody_.AddForce(direction.normalized * -1 *force * Time.deltaTime, ForceMode.Force);
But it didn’t work
P.S I tried also to do
rigidbody_.AddForce(direction.normalized * -2 * force * Time.deltaTime, ForceMode.Force); and it works. But I want to addforce with the same force.
What you did should work, multiplying by -1…
How do you define the direction?
What’s the rest of the code?
You should not use ForceMode.Force with a force multiplied by Time.deltaTime, ForceMode.Force already multiplied the input by Time.fixedDeltaTime, just like ForceMode.Acceleration.
You also need to make sure you are calling this on FixedUpdate.
Except for that, adding a - before direction or multiplying by -1 should work.
If you need to multiply by -2, maybe you’re still calling the previous force as well? If you’re calling both they’ll cancel each other out.