0
\$\begingroup\$

you can see my cube position and ground inspecter in this imageyou can see in images my cube is falling as i play

Inspite my ground and cube contains colliders as i apply rigidbody it falls down....use gravity

\$\endgroup\$
1
  • \$\begingroup\$ @DMGregory still didnt work \$\endgroup\$ Mar 13 '20 at 13:46
1
\$\begingroup\$

A mesh collider is not the best solution here.

For one, they're unnecessarily expensive for collision with a flat ground plane. You're searching a polygon soup for a collision when you could be doing a cheap primitive check.

Second, a (non-convex) mesh is infinitely thin — it has no inside/outside that the physics engine can use to detect penetration.

So if your cube spawns even a millimetre below the surface, the physics engine just knows there's an intersection. It doesn't know which way to push the cube to get it "outside". So it's as likely to tunnel through the mesh and fall out the bottom — that's just as valid a way to resolve the intersection from the physics engine's point of view.

Instead, create a box collider under the floor of your market, and give it some thickness so it can catch even a fast-moving object falling into it. A primitive collider like this has a defined interior, so if the cube ends up anywhere inside that volume the physics engine can still detect the penetration and push it back out in the right direction.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.