Reputation: 876
The Problem: Mesh colliders on some rigidbody objects are passing through colliders on other objects.
Things I have tried:
With the assumption A is a GameObject
with a RigidBody
attached and B is a normal GameObject
with a collider.
I have tried all of these in all combinations of A and B.
In addition,
Constraints: I want A to use a mesh collider since most of the objects involved are moderately complex, and fitting other colliders to them would take a while.
Weird Behaviour: I have some objects with both rigidbody and convex mesh collider where the collision is working fine with a non-convex mesh collider. This is inconsistent with other gameobjects. The objects have all of the same settings.
I am using unity version 2019.3.11f1 if that is relevant.
The object being used are from this package. Specifically, the filing cabinet with rigidbodies on the drawers works fine. The desk, office chair, pen, and open laptop all fall through the "floor" (a cube with all of the above colliders tested on it).
Upvotes: 2
Views: 13885
Reputation: 2843
This seems to be a common big problem, and I have been struggling with the same issue for days, and have finally fixed it, so am feeling like I should highlight one important thing:
move Rigidbody
via MovePosition
, not via just changing its position
field directly, nor via changing position of GameObject
holding it.
Changing position via "wrong" ways will "teleport" your rigidbody, physics won't fully work on it in that case.
Upvotes: 1
Reputation: 21
I'm assuming -you game object which contain the mesh component is very small ( bellow 0.7 size(x,y,z) so the game engine is little difficult to detect it)
and also
Upvotes: 0
Reputation: 31
I am Assuming you have set your Collision Detection to Discrete
In your gameObject's RigidBody
, if so, please make sure to select Collision Detection
to Continuous
In your gameObject's RigidBody
.
Reason Why this is not working
You are trying to use collision that has (speed > your Computer's frame speed) so, the frame is not catching the collider properly some time catches and some time fails to catch.
You are moving your GameObjects with tranform.translate or position etc. If so then make sure to use Rigidbody Related
function for Positioning, rotating.
Solution Image For First Problem
Upvotes: 1
Reputation: 2586
Do you have 'isKinematic' checked on the objects with rigidbodies that are going through other colliders? If so uncheck it so that external forces affect it.
edit you also need to click convex on the mesh colliders if they are colliding with other mesh colliders, Convex Mesh Colliders are limited to 255 triangles, are the objects that are not passing through have more than 255 triangles in geometry?
Upvotes: 2