Objects falling through floor

I’m working on a vr game where you can pickup an object and place it down, I want the object to stay put and not move when bumped into by other objects. I set it up so that when it collides with the floor it becomes kinematic and doesn’t move, that works if I drop the object and let gravity take it, but if I place the object with my hand, if it intersects or goes through the floor at all, it falls into oblivion when I let go. I have the floor set with a box collider and rigidbody and a separate game object is the trigger and all the objects being picked up also have rigidbodies and box colliders. What am I doing wrong?

On rigidbodies, turn Kinematic on.

4 Likes

Wow, it really is that easy, Thanks!

2 Likes

Years later, still just the right answer that I would not have guessed.
Thank you, Paulbuck86!

Update: After I activated Kinematic on my object’s RigidBody, although my moving object no longer fell through the surface, it also no longer responded to the AddForce I applied to its RigidBody. I had to add a Capsule Collider to my object, & then it worked.

I can’t figure out, though, why the Box Collider on the object didn’t prevent it from falling through the surface, but the Capsule Collider did. And why did selecting Kinematic on the object’s RigidBody stop AddForce from working? Does anyone know?

2 Likes

Im having a similar issue. I wonder why this happens :confused:

1 Like

It’s because the whole point of Kinematic is to place your object no longer under the control of the physics engine. This is only the right solution if you want your objects to no longer be affected by physics.

It’s probable that the box colllider was marked as a trigger.

https://docs.unity3d.com/Manual/class-BoxCollider.html says:
“Is Trigger: If enabled, this Collider is used for triggering events, and is ignored by the physics engine”

These colliders do detect collision (ie intersection with other physics objects), but do not prevent it.
If you want to do both, you may be able to do it with a single box collider, which is not marked as a trigger; or you may be best creating two; the one to prevent collision being slightly smaller than the one to detect it.

hey, change collision detection from the rigid object to continuous fixed my problem

3 Likes

It’s 2022, and I’ll end this problem once and for all:
How to prevent a rigidbody object from falling through the floor:

  • Settings for the floor: The floor must have a collider component, and the collider component must have isTrigger property UNselected.
  • Settings for the object: The object must have a collider component, and the collider component must have isTrigger property UNselected. The Collision Detection property of the rigidbody component can’t be Discrete (it must be continuous __).
3 Likes

Nah, at the 2 u said, the isTrigger is needed for example : collecting it, if u do that so how can we- player collect object on ground ?

A easy fix is adding 2 colliders on the object. Set one as trigger and other not. I am sure there is a better way but this is fast and easy. Object has gravity/physics and still is a trigger

1 Like