Colliders not working even though set up corrcetly

Hi everyone, I’m having quite an issue with the collisions I have set up in my project, I did some Custom Collisions that are has fallow:

Engine Collision:

Player Collision:

Mineral Collision:

And here is the Collisions working in the project during the editor Play, and has you can see the Player can enter into the Stone without it being blocked by the collision set up:

In this image we can see that the player has the collision profile set up to the Player profile:

While in this one we can see the stone that has the Minerals profile:

but has you can see in both images the player walks inside the stone without any problems, both of them have a capsule component to detect the collision but it won’t work right now for some reason, any help for this issue will be quite appreciated.

Thank you.

Hello ,

In these two assets, what does the hierarchy look like for the components? Are the Capsule components set as the roots? Are you setting these collision presets on the Capsule or directly on the mesh components themselves?

As for the collision event itself, what method are you using to move the actors to collide with each other? Depending on what you’re using, it may be the part that is ignoring the collision. I would suggest making some print string functions to print off when OnHit is called or any of the collision delegates that would apply in this situation to see if maybe the collision is happening but the method of movement you’re using is ignoring the collision and moving through anyway.

Hi Matthwe and thank you for your quick response, Has you said I tired adding the OnHit function but they don’t get fired at all in the system, I’ll post the Hierarchy for both the player and the resource, but I’m setting the collision for both using C++ so when I tried to set it in the static mesh I couldn’t find a way to actually set it without having to add a BoxCollision.

I’m moving the player using the Tick function by setting the desired movement location to the clicked position and if the clicked position is a StaticMesh or actor, it should go to the position of that item.

Here is the Resource Hierarchy:

And the Player hierarchy:

If you need the ResourceBoxCollision to do your collision for you, it’ll need to be the root component instead of the StaticMeshComponent.

Well I would love that the mesh would handle the Collision but I don’t seem to find a way to set the collision’s to the mesh do you have any Idea how I could do it?

Thank you.

Have you set the mesh’s collision in the mesh asset itself? Open up the Static Mesh asset that you’re using for this component and then select the “Collision” button on the toolbar at the top to turn on the visualization. Does a wireframe that represents the collision show up? If not, try selecting the Collision dropdown and selecting one of the add options to add a default collision.

If it’s still not working after doing this, try dropping the mesh itself into the level and see if the character will collide with it.

Thank you, I proceeded to set the Collision inside the Mesh that I’m using for the resource, here is an image of the new setup for the Mesh:

And well It’s still letting the player enter the resource even though I have changed this values:

Here is the way that I add the Mesh into the StaticMesh Actor, I use C++:

Path = "StaticMesh'/Game/TestContent/bridge.bridge'";
			Mesh = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, *Path.ToString()));

(Cast<UStaticMeshComponent>(RootComponent))->SetStaticMesh(Mesh);

Hi Matthew, I just wanted to let you now that I added the OnHit function now completely but it still didn’t work, I had forgotten to do the OnComponentHit.AddUniqueDynamic setup, the other thing I didn’t tell you about is that the rotation and location of the player are set constantly using the Tick function of C++ using PlayerDirection->SetWorldRotation() and SetActorLocation() respectively, I’m not sure if this could be the cause.

And I also sent you the project download link so you can have a better grasp on what’s happening. Thank you for your help.

Hi Matthew, any idea on what could be the issue, I sent you the project so you could test it.

Thank you.

I’ll be taking a look when I get a chance. It’s possible that it won’t be until next week, it depends on how busy the rest of this week is.

Hi Matthew, Any news about this issue, if you are still quite busy I understand, I’ll continue working on other things in my project but I wanted to know how this was going. Thank you

Hi matthew.

Yes here is the link sorry for not answering before, I was working on other things in the project but didn’t get in the Anwserhub all day.

https://drive.google.com/open?id=0ByER1oWGtkdbSm11ektUeFEyOU0

I finally got a chance to take a look at this and have noticed a few things.

You’re using MoveTo for your movement. MoveTo is a type of movement that doesn’t involve sweep and ignores any kind of collision, which makes the character an unstoppable force when moving. The resource on the other hand is not simulating physics and cannot move. When these two meet, even if their collision is set up correctly, they won’t be able to affect each other. I suggest looking at the Top Down C++ template and how they handle movement there. I’m not sure how practical this will be as you seem to be planning around having your layout not be determined until the start of the game and I don’t think that would work well with a movement system that relies on Nav meshes. You may need to think more in a way of preventing them from colliding rather than trying to handle what happens when they collide, depending on how your game is supposed to be set up.

Hi Matthew, the MoveTo I’m using is a version created for my on struct and just indicates the position that was clicked, the actual movement and rotation handling are set using the SetActorLocation() and SetWorldRotation() methods, in case that the clicked position is an object, it grabs the position of the object and subtracts the bounds of the object so it stops just in the edge of the object, or at least that’s what I have been trying to do with the code, I will set the resources to simulate physics but disable there gravity do they don’t fall through the floor.

Hi matthew, any news about this last info about the MoveTo that I created?

I’m currently looking through the code but it’s quite difficult to follow as there aren’t any comments to indicate what anything is doing throughout. I can say that what I mentioned previously still stands. When using SetActorLocation, it’s basically teleporting your character and ignoring all collision. Have you had a chance to take a look at how this type of movement is done in the Top Down template?

Hi Matthew, I finally got it to work so thank you, it was in fact that the player character needed to have it’s physics component activated, then I only restricted it so it wouldn’t rotate when it hit’s something and after that it worked perfectly, now I only need to do some extra movement stuff for the touched resource so it won’t always go to the same spot, but that is something entirely different. Thanks for your help.