Multiple hits recorded

When I bump into a wall, I get the Message “Wall Hit” like I am supposed to, but when I hold it there it registers multiple, and counting, hits. I have made Frank a Prefab, so he’s multiple parts, that seems to be the problem, maybe. I have a mesh collider on the whole prefab, and tries a box, but didn’t work either. Is there something I can do to fix it? So I can make use of the “enter” part of the method.

Thanks.

PS: This course is AAA, I’m impressed and excited to continue.

Hi LongTooth,

A collision event happens between two colliders. If you are getting multiple messages, maybe Frank or something else has got multiple colliders. Log Time.frameCount into your console to see if the collision events happen in the same frame.

1 Like

I had the same issue with my player. Turns out I forgot to remove the colliders from the individual pieces of the player .

2 Likes

Thank you both.
I took off al the extra colliders, and left the mesh collider on the parent, but then it wouldn’t collide. I ended up changing the character and putting on one box collider and that works. Is there another solution to use the mesh collider, am I missing something?

Thanks again.

The mesh collider should be on the same object you have the rigidbody, or on a child of that object. This script should also be on the same object you have the rigidbody on.

You said you changed characters. Did that different character have the same tags and layers?

1 Like

I do have it on the same object as the rigidbody. There is nothing on the children (parts of Frank)
I had a mesh collier where the Box collider is.
I just changed Frank to be more boxlike to fit in a box better, all the same stuff.

I have moved on with the lesson, but It would be good to know for the future. Thank you!.

i’m not sure, but I suspect the problem is that the Mesh Collider won’t work without a mesh (and mesh filter) on the same object.

If this was not the case, you should have been able to see a green collider wireframe “skin” surrounded your object when you added it on. If you did not see it, the mesh collider may not have a mesh to shape itself around.

1 Like

I think you’re right there. no green outline. I’m guessing the best be it to make it in Blender then import. Thank you.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms