- Home /
Box collider didn't jump with player
Hi, I'm creating a 3D "endless running" game. I've added a player to the scene with two different animations (run and jump) taked by Mixamo. Now I would like my player to die after touching an object. In order to make this, I added a box collider to the player but I've noticed that the collider didn't jump with the player. In other therms the collider didn't follows player movements. How do I make? Thanks for answering.
Answer by Brodenski_blox09 · Nov 15, 2021 at 06:46 PM
You might have attached the box collider to something else. In Unity, the colliders usually follow the object they are connected to. Did you make the box collider big enough? Try testing when the box collider touches another object using this code:
private void OnCollisionEnter(Collision collision) { Destroy(gameObject); }
Make sure the object it touches also has a rigidbody and collider.