- Home /
rigidbody with fast gravity goes inside walls
Hello,
i have rigidbody player and control the gravity by Addforce, but when the gravity is so high it goes inside the wall. i've tried making the gravity lower and it works. but it's so slow gravity .. i need much force and speed for the gravity
how do i prevent it from going inside the wall ?
by the way, it's not so fast that it should go inside the wall.
GRAVITY CODE: (Gravity: 40 - rigidbody.mass: 1).
rigidbody.AddForce(Vector3 (0, -gravity * rigidbody.mass, 0));
Answer by robertbu · Aug 17, 2013 at 09:33 PM
You can reduce the problem by going to:
Edit>Project Settings>Physics
...and setting Min Penetration for Penalty to a lower number or even 0.
In addition, if you go to:
Edit>Project Settings>Time
... and set Fixed Timestep to a lower value (like 0.01) might have an impact.
You can also take a look at this script:
it WOR$$anonymous$$ED! i don't know if this will last. but for now everything is pretty good!
Thanks!