Rigidbody object falling through floor.

I have a rigidboy object that needs to act as a trigger, is has a rigidbody/mesh collider/mesh renderer/mesh filter attached to it.
The collision object is positioned on the floor beneath it, it has a mesh filter and a mesh collider, it has an emitter attached to it which is coded to turn on when the collision is true.

going back to the rigidbody, the convex is ticked and the is trigger is ticked on the mesh collider, this is because it needs to work with its colliding object, but the problem I have is that the object keeps falling through the floor when is trigger is ticked.

When i remove the is trigger tick, it doesnt fall through the floor, but it doesnt act as a trigger which I need it to.

If this doesnt make much sense, please see this thread i made about another previous issue…thanks.
link text

If you have that waterfall plane's collider set isTrigger and your trigger script on it, then the rock with collider not set isTrigger should fire that script and keep your rock from falling through the ground.

–

but if the rock collider isTrigger isnt set, how will it tell the plane collider the collision is true? I tried your method but didnt get much luck.

–

Should work. Just copy/pasted that C# code I posted the other night in a script (deleted the non-drag&drop emitter stuff off of it) , attached it to a game object, put a collider on it with isTrigger set. Then put a child object on that with a particle emitter/animator/renderer. Drag/dropped the child object onto the parents script slot for the emitter object. ... Then made another object with a rigidbody and collider not trigger, tagged it as "Rock" , moved it into the trigger in play-mode and it shut the emitter off. Moved it out, emitter turned back on.

–

I'm attempting this now, but i keep getting the following error, "A namespace can only contain types and namespace declarations" on lines 4, 6 & 11.

–

Ok I got around that issue, and i followed the rest of your steps, but the emitter is still not reacting to the rigidbody when they come into contact ![alt text][1] ![alt text][2] [1]: http://answers.unity3d.com/storage/temp/988-waterfall+1.jpg [2]: http://answers.unity3d.com/storage/temp/989-waterfall+2.jpg

–

8 Answers

8

Remove the RigidBody component from the ground, keep only the Collider on the ground. On the other objects, you keep the RigidBody and Colliders.

This solved it for me. I don't think it makes sense at all, but it solved it. Please explain if possible as to why objects will fall though ground if the ground has a rigidbody. Thank you.

–

isTrigger will make that collider pass through other colliders so you might make another collider a child that will be affected by physics or use OnCollisionEnter.

Thanks this might explain the whole issue, I take it OnCollisonEnter would mean I would have to re-write the script into Java? its currently this in C#... public class Waterfalltrigger : MonoBehaviour { ParticleEmitter myEmitter ; void Start(){ myEmitter = GetComponentInChildren<ParticleEmitter>() as ParticleEmitter ; } void OnTriggerEnter(Collider other){ if(other.CompareTag("Respawn")) myEmitter.emit = false ; } void OnTriggerExit(Collider other){ if(other.CompareTag("Respawn")) myEmitter.emit = true ; } }

–

the "Respawn" tag is given to my rock

–

thanks man.. you just made my day 8 years later :)

–

Uncheck the Use Gravity option on your rigidbody to prevent gravity from being applied to it.

thanks man, worked like a charm for me

–

I had same issue: Rigidbody object falls through the Terrain. I checked ALL answers regarding this issue, but my issue was still not solved.

First, let me give you my Character setup, if you have similar setup, maybe this is the fix for you: Character Hierarchy is: PlayerParent (Empty Object)>PlayerChild (Mesh, Rigidbody, Collider) + Camera (Child of PlayerParent).

After some tests, I realized, my character do not have any problem when starting at Transform Position Y: 0 or 1. When character is on Terrain, naturally it has to start above SeaLevel, which is above Y: 50 (or another water level you designated).

Let’s assume PlayerParent starts at Y:65. If PlayerChild is at Y1, PlayerParent keeps it at Y:66.

When game starts, Parent Object stays at 65, but Child always moves/teleports to -65. If it has Rigidbody with Gravity turned-on, then object starts to fall down. At first I had thought, object was falling through the terrain, but then I realized this starts as Object spawns at -65 first, then falling…

Real Reason of the Problem:
This issue is due to Spawn order of Unity. Therefore I solved by creating additional spawning time for PlayerChild. Because, PlayerChild spawns at position of Parent when parent is at Y:0. Then Parent moves to Y: 65. So child’s position becomes -65 relative to parent.

Here is how I solved it:
I added NextFrame Event for creating PlayerChild, then I set PlayerChild to Y:1 in the code (I use Playmaker for scripting). So when objects are created, this iterates the position of Playerchild again, then when PlayerParent is at 65, PlayerChild has Y:1 (world position at Y: 66),

I hope this can be helpful for somebody who has similar issue.

you could always just change your rigidbody to “isKinematic” to prevent it from falling.

I tried this but its doesnt move what so ever

–

That's way overkill.

–

This helped. Thanks.

–

Ok ive figured it out, the waterfall trigger needs convex ticked. work fine now. Thanks guys

attach a collider to it (box collider recommended)

hey thanks for the help, I've long since abandoned this particular project but when dealing with rigidbody issues in the future, I'll bare this in mind.

–

Just add a capsule collider and make sure the ground has a box collider