- Home /
Mesh and Sphere Collider Not Registering
Alright, so I am trying to learn the basics of Unity so I made a 3D level in Blender for my character to walk around in. It works perfectly but when I add my bullet into the level, it just bounces off the walls instead of disappearing.
void OnCollisionEnter(Collision col)
{
Debug.Log("Hit!");
}
I have this section located in my Bullet class. The bullet GameObject has a rigidbody, and the level has a mesh collider. Please help I cannot figure this out and it would be gret to move forward! Thanks in advance.
...It works perfectly but when I add my bullet into the level, it just bounces off the walls ins$$anonymous$$d of disappearing.
Colliders are supposed to collide and react accordingly, not disappear upon collision. If you want it to disappear, you have to make it disappear.
https://docs.unity3d.com/Documentation/ScriptReference/Object.Destroy.html
@Lo0Nuhti$$anonymous$$ sorry... I meant I want to have the bullet disappear on collision and I have that code implemented but the actual collision is not registering
This script is attached to your bullet, and when your bullet hits a wall and bounces off of it the Debug isn't printed to your console?
Answer by hero_kenshin · Mar 27, 2014 at 03:18 AM
I believe collisions only work when both objects in the collision have rigid bodies Try adding one to the wall to.
https://docs.unity3d.com/Documentation/Components/DynamicsGroupOverview.html
@hero_kenshin Scroll down a little way on that page to where it talks about Static Colliders
Answer by Lucas.Giancola · Mar 27, 2014 at 04:39 PM
Thanks for all your help... I ended up adding a few more components to each GameObject and changing some of the setting and I got it working!
Your answer
Follow this Question
Related Questions
Combine common surfaces 1 Answer
Glitchy Convex Mesh Collider 1 Answer
player falling through walls of blocks in voxel game, collides with floor though. 0 Answers
Collision massively misplaced 0 Answers