- Home /
Rigidbody falling trough terrain
Hello,
I hit the dead end when I tried to introduce different heights into my game. I created terrain and painted some hills on it. Then I created a capsule with Rigidbody component and attached Movement script which uses rb.MovePosition() function to move the rigidbody. When I create a few cubes and other obstacles it seems to work fine. But when I move around on terrain where is some slope, the player falls through the terrain and jumps above it periodically. I tried playing with different terrain settings and also with rigidbody settings on a player but nothing helped.
I created a package so it's more obvious what I'm talking about.
https://github.com/vitvepav/RPGTestMovement
Issue can also be seen in this picture:
This issue also happens on small slopes but here its more obvious.
Any advice is appreciated.
Thank you.
Answer by Prdik · Sep 20, 2018 at 05:19 AM
Thanks for your answer @theGreatSlutze , but I tried both things and the issue remains. I also tried different collision detection types (amongst a lot of other things), but no luck so far.
So I haven't found the solution yet, but I used this small addon from AssetStore to convert terrain into a mesh and I didn't encounter any glitches when moving the player. If anybody is interested, it's called $$anonymous$$esh Terrain Editor.
https://assetstore.unity.com/packages/tools/terrain/mesh-terrain-editor-free-67758
However, I still wasn't able to resolve the terrain problem yet.
Answer by theGreatSlutze · Sep 19, 2018 at 02:45 PM
Couple of things you might try:
-Playing with the interpolation (interpolation-interpolate or interpolation-none) and seeing if either of those help
-Adding velocity to the rigidbody instead of using MovePosition. I think you'll get more reliable physics simulations this way.
Your answer
Follow this Question
Related Questions
How to make a deform on a terrain with the points on a collision of rigidbody 0 Answers
Player's Rigidbody slides up terrain walls 1 Answer
Object Flies into Air Upon Collision, or goes through hill depending on isKinematic settings 1 Answer
Terrain collider failing in unity 5/17? 1 Answer
After parent change, rigidbody falls through terrain 0 Answers