my character is falling through the floor

I want to have a character made out of cubes and affected by gravity to be destroyed per cube when I drop a ball on it with a script to destroy everything it touches. I want to let the character move too.

I have a character made out of different cubes parented to an empty gameobject with a rigidbody. all the cubes have a box collider. I have given all the cubes a kinematic rigidbody which let the cubes be destroyed seperately if I toggle off the gravity of the empty game object. But when I toggle it on my character falls through the floor.

Is there a way to not let the character fall through the floor?

Thanks in advance.

Ok, I did some testing and I think I found a way to answer your question. When force is applied to a kinematic object, like a player falling due to gravity, the kinematic object ( to put it simply) can be interacted with, but does not interact with the world. That might be confusing, here’s a link to the manual : Unity - Manual: Rigidbody component reference
You will just want to look at isKinematic. Basically it’s used for interacting with objects with collision, but without moving them (Like the doc says, moving platforms)

This answers page has a pretty good explanation of kinematic bodies too: isKinematic rigidbody collisions - Questions & Answers - Unity Discussions (Look for the answer in like 20pt font)

You still have the question about making your character NOT fall through the floor, and I also understand where your need for kinematic rigidbody comes from, so I will suggest one of two things.

  1. Try to raycast collisions (This is kind of difficult and sometimes not too reliable)
  2. Make a gameobject for the feet of your player, position it correctly and then take off the mesh renderer and set its box collider to isTrigger. Then you can make a basic script for detecting collisions with that. ( I have a script like this, so if you can’t figure that out I can help you there too)

Maybe this helped or it was just confusing, either way hope you can figure it out!

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