x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text

Player Collision: alt text

Mineral Collision: alt text

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: alt text

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

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.

Product Version: UE 4.12
Tags:
more ▼

asked Aug 16 '16 at 03:08 PM in Using UE4

avatar image

WolfAlvein
23 14 17 22

avatar image Matthew J Aug 16 '16 at 07:37 PM

Hello WolfAlvein,

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.

avatar image WolfAlvein Aug 17 '16 at 05:20 AM

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:

alt text

And the Player hierarchy:

alt text

avatar image Matthew J Aug 17 '16 at 02:25 PM

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

avatar image WolfAlvein Aug 17 '16 at 02:36 PM

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.

avatar image Matthew J Aug 17 '16 at 02:47 PM

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.

avatar image WolfAlvein Aug 17 '16 at 03:10 PM

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:

alt text

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

alt text

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);


stone mesh.png (564.1 kB)
collision.png (1.0 MB)
avatar image WolfAlvein Aug 18 '16 at 05:05 AM

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.

avatar image WolfAlvein Aug 18 '16 at 05:46 PM

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

Thank you.

avatar image Matthew J Aug 18 '16 at 06:12 PM

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.

avatar image WolfAlvein Aug 25 '16 at 05:58 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Aug 29 '16 at 07:12 PM

avatar image WolfAlvein Aug 29 '16 at 07:28 PM

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.

avatar image WolfAlvein Aug 30 '16 at 07:55 PM

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

avatar image Matthew J Aug 30 '16 at 08:11 PM

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?

avatar image WolfAlvein Aug 31 '16 at 07:19 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question