Can you stop objects which have isTrigger enabled from falling through the ground

well I know this is probably a really stupid question but can you and if so how please? thanks

5 Answers

5

The solution depends on what kind of object it is and what you need it to do.

If you just want the trigger object to be stationary and unaffected by physics then you could set it to kinematic and disable gravity, freeze the position or just remove the rigidbody entirely if the things colliding with it are all going to have a rigidbody anyway.

If it is something which you do want affected by physics and moving around then you’re probably best off not having it set as a trigger and just using a normal collider.

If it is something more complex required that neither of these problems fixes then using an empty gameobject as a parent with a collider on the parent and the trigger on the child may work for you. Depends what you need that trigger for really.

I’m assuming that the ground also has a RigidBody but is not a trigger. Add a script to the ground that watches for trigger collisions, and test the type of collision being fired. If the trigger being fired is from one of your trigger objects, set that objects velocity accordingly to stop it from moving.

I believe that you’ll still have an issue where the trigger object stops at the collision then slowly slides down through it. In general if you need an object to stop upon collision with another object, then it should not be a trigger. But I get it if that object should also not physically collide with another object.

I'm not a blender artist - only you can answer if it matches the humanoid rig structure. pull in a mecanim humanoid rig from one of the asset packs into blender. See if the bone structure matches. How about the avatar definitions? Make sure the avatar definition for the rig AND for the animations you create are from that model. See if that is the problem.

Depending on your needs:

1: Turning off gravity on your gameObject, though if you need it to fall, this might not be what you want.

2: You could use a RayCast going down from your object and check if the RayCast hits the ground. You can set the distance to the RayCast however far you need to stop.

3: Locking the Y position of your object’s RigidBody and turning off gravity. This is what I usually use and recommend, assuming that you don’t need the object to fall later.

4: Like what Magius96 said, you could use OnTriggerEnter to check if they collide and adjust the velocity.

That didnt really solve the issue, it would just have slightly different rotations but still not the same as the animation in blender.

This fixes the problem

You could do any of these things. OR: You could also add another Box Collider that does not have is Trigger enabled. Just an additional option. :slight_smile: