I’ve been searching the forum and I found contradictory information about the CharacterController and OnCollisionEnter.
What I need:
I want a floor object which should break if the player jumps to hard onto it.
So, I have my player character with a rigid body and a character controller attached to it.
I have my floor object with a rigid body, a collision box and a script to detect OnCollisionEnter() attached to it.
When I let fall a box onto my floor object (box with rigid body and collision box), OnCollisionEnter get’s called.
When I jump with my player character onto the floor object, OnCollisionEnter is not called.
So… how can I solve my problem? I need the collision force to determine if the floor object should break or not…
Yes… but that doesn’t give me the force of the collision as does OnColliderEnter. I only can detect that I touch something but not the force which is generated by this. So that function does not help me.
That charactercollider solves quite some problems; but it also has some really stupid limitations.
If anyone could either tell me how to use oncolliderenter or calculate the collision force using the travel distance…
OnControllerColliderHit is called from Move, which YOU call, so you know what velocity caused the hit. From that and the normal of the hit, you know the force.