Group Group Group Group Group Group Group Group Group

Chapter 4 - Physics the bullets pass through the Mesh Collider

Hi everyone, I am following this book with great interest, I’m new in Unity programming. I have a strange behavior in the scene of chapter 4. When the SpaceMarine shotting the bullets pass through the Mesh Collider attached on the World_Centre but the other GameObject in the scene not. I don’t understand that is a normal behavior or not. I think that the bullets should bounce on the wall and not cross it but I do not understand what’s wrong. Has this happened to any of you?. Thanks alot for your support.

HI, Lordgunny, I had the same problem

@vegetarianzombie Can you please help with all of this when you actually get a chance after all? Thank you - much appreciated! :]

Same problem here too. Bullets do not destroy so I looked outside arena and saw them flying off into the distance. Not hitting the arena mesh collider for some reason. Book writer any help here?

It sounds like your bullets may not have a collider or the bullets may not have the scripts attached to them which destroys them on contact. Take a look and let me know what you find. Cheers!

The bullet hits the column and bug just fine and disappears. I can see the inner octagon green lines. I just tried it again and some of the bullets hit the wall and disappear but if I change direction they go through the wall.
I am looking at everything now to see what I did wrong.
I loaded the book version from the chapter and it does just fine so it is my fault somehow.

Actually bdmoakley, I just reloaded your chapter 4 final main.unity and the bullets go through the wall on it also.
I put a video on youtube of what is happening see below link. It seems to only be certain parts of walls.

Ah, I see what you mean. It looks as though the projectiles are taken a few frames to be destroyed. Looking at the hierarchy, they appear to be deallocated. I never saw this as a bug, but if this does bother you, you can shrink the size of the mesh collider.

Now, if you are seeing projectiles that aren’t being destroyed, then the projectile may be moving too fast for the engine to detect the collisions. You can avoid this by increasing collision detection on the actual projectile. Of course, this will increase the resources required by your game.

I hope that helps!

Thank you!!! Thought it was something I did but I couldn’t find my error.

Yeah, that’s one of the annoying parts of Unity. I remember building a breakout game a view years ago and the balls acquired speed with each hit. Unfortunately, they ended up going so fast, that they started ignoring the colliders. It was a maddening bug.

In any case, I’m glad to help out! Cheers!