So I’m new to game dev and currently following a tutorial from udemy and I’ve created a robot that shoots a projectile however the projectile just doesn’t collide with anything and I’m not sure why. It has a box collider on it and uses simple collision not complex. I’ve got the feeling I’m being stupid and I’ve just missed something tiny.
Hey @Mischiefstudios!
Can you click the “>” on the collision preset? That will give us info on all of the things it should collide with.
Have you tested it against multiple kinds of colliders? Static, Pawn, etc?
Get back to us soon!
First here are the collision presets
And yes I have tested it against both static and pawn and it passes straight through them both. For a bit more context I created a simple blaster beam shape with the modelling tool and then duplicated it, and that is the static mesh that I’m putting the collider on. Not sure if that helps
It might be the customized collision box?
I’ve never once in my years and years used that box.
Another thing to check is: Which component do you have selected for this? Because the mesh and the box collider will have two different ones.
Yet another thing: Try turning down the speed. It may be going too fast for the method they’re using, things can tick past their collision!
I have it selected for the mesh and I turned down the speed but still no luck. I’m considering just restarting because I’m not to far in however are there any tools that I could use or any techniques I could use to try and debug the issue. For example I know of the collision analyser (although I don’t know how to use it). Even if I can’t fix this issue I would appreciate the knowing for future projects.
It is likely that the mesh itself was not given collision. To do this you have to open the mesh file, and at the top where it says “Collisions” you choose a collision to add.
However, for the purposes of this tutorial (and usually performance) They are probably adding collision to the BOX collider, not the mesh. The mesh is for visual representation, but it doesn’t need anything more than a box- if you use complex collision on the mesh for collision it’s very hard on performance comparatively.
Can you show your code? You say it’s not colliding, which could mean a lot of things. Can you provide:
The intended behavior (something like stopped by walls, or disappears when it hits a wall etc)
The overlap code if there is any (If it’s meant to do anything other than stop you need overlap not block)
Thanks!
I just selected the beam mesh in the bluprint and set simulate physics on and now it collides. I can tell because the only piece of code I have just checks if the beam hits something then prints the name of the object it hit and it wasn’t doing that prior. However, the projectile movement component has stopped working and I’m not sure why the blaster beam is instantiated and then just doesn’t move. The mesh is set to movable? The intended behaviour is for it to be stopped and blocked by everything not to dissapear just to stop. Not sure if I’ve taken a step in the right direction or backwards lol.
So huge update I made the blaster beam the root component and it now it flies forward and collides with the wall like intended. It does bounce of the wall which isn’t the intended behaviour but I’m sure I can work that out. The only thing I’m concerned about is if this is a valid solution or if i’ve just kinda found a cheesy makeshift solution that will cause problems for me later.
I am super angry right now. I just turned set simulate physics of and the projectile still has collision it just doesn’t bounce. The entire issue was because the beam wasn’t the root component. I had no idea that this needed to be the case to get collision to work
Ah. Yes, that is the case for things using the projectile movement component. I hadn’t thought of that.
I did want to come in and say that is NOT typical, it’s something that the projectile movement component needs.
Glad you got it figured out!