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"

[Bug Report]UE crash when getting Material Interface Reference from Hit

My goal is to get the graphical material of the ground where the player stands, and use that to spawn some debris that are similar to it.

I don't even use the Impact Material yet anywhere, it's just an unused input now, but it makes UE crash instantly.

Do you have any idea, how can I fix this, what do I do wrong, or how should I do it instead?

alt text alt text

Product Version: UE 4.12
impactcrash.png (89.4 kB)
impactmaterial.png (84.2 kB)
more ▼

asked Jul 25 '16 at 04:12 PM in Bug Reports

avatar image

529 25 25 43

avatar image CrimsonHawk Jul 25 '16 at 04:17 PM

I didn't put it in the "Bug Report" section. Could a Staff member change it for me please?

avatar image Adam Davis STAFF Jul 25 '16 at 06:27 PM

Hi CrimsonHawk,

Have the event on landed do an IsValid Check for your hit actor before running the On Impact function. It sounds as though it is pushing a NULL value then attempting to run the On Impact function anyways, which could lead to a crash.

avatar image CrimsonHawk Jul 25 '16 at 10:51 PM

I tried this configuration, and also tried to wire it to the "Hit Component", but same result both time. If I'd ask only the Point, or the Normal, there would be no problem.

By the way, for error replication: The ThirdPersonCharacter lands on the Floor object from the ThirdPersonExampleMap.

alt text

validmaterial.png (120.8 kB)
avatar image Adam Davis STAFF Jul 26 '16 at 05:38 PM

alt text

This is more what I mean. If you use the IsValid check on the hit actor pin, it should prevent the NULL value from attempting to populate the impact material if nothing is hit. Try this and see if the crash still occurs.

hitactorvalid.png (136.7 kB)
avatar image CrimsonHawk Jul 26 '16 at 08:28 PM

I tried this configuration on the picture. Similar strange results. It finds the Actor valid, but if I try to read its material it crashes the engine.

This way it writes out Floor as expected. When the wires changed to the material, it crashes. Even like this when the Index parameter is constant False in the Select.

alt text

By the way, Event On Landed event is a built in one.

validhit.png (252.3 kB)
validhit.png (252.3 kB)
avatar image Adam Davis STAFF Jul 27 '16 at 03:40 PM

Can you send me a sample project so I can see what may be occurring?

avatar image CrimsonHawk Jul 27 '16 at 03:58 PM

I think I found the source of the problem. The Hit Item gives the Element Index -1. And since it tries to reach an incomprehensible value for Get Material, it crashes. But anyway, I link here a Google Drive link for a small test project. It really doesn't need more than what I've shown on the pictures. Just jump one with the Space and it's gone.


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

1 answer: sort voted first

After looking into your project, I believe I understand what is occurring and what can be done to accomplish the task you are looking for. As you stated, the array index < 0, so the crash is expected behavior. Having said this, the Hit Item pin is not going to be useful to you when attempting to get a material, I would ignore this pin completely. For now, you should be able to get the material of the component as you are and simply use element 0 unless you need a specific element in a mesh that has multiple elements for materials. Then, you can check to see if that material is of a particular type (water, dirt, etc.). Based on what selection you use, you can set the particle system to the impact point.

Having said this, there is an easier method, which would be to use a physical material and switch on enum from that physical material that you set. You can set surface types in the project settings>Physics menu. This would allow you to easily set a number of different surface types that your landed effect could spawn particle systems for. Further, you could do it with a simple switch on enum as seen in the image below. There is, however a known bug, UE-33828, that prevents this from being used at present, but once a fix is implemented it is the method I would highly recommend as you will have significantly more control over the end results.

For more information on how to set up and use physical materials, check here:


alt text

more ▼

answered Jul 27 '16 at 05:47 PM

avatar image CrimsonHawk Jul 27 '16 at 05:56 PM

Thanks for you fast replies and helpfulness, I will use this solution then! I was thinking about implementing physical materials at one point, but that needs quite lot of other implementations to do, and for now I'm just trying to learn to use other basic elements of the engine. Anyway, returning -1 instead of 0 is still a small glitch, isn't it? Or is that how it supposed to work?

avatar image Adam Davis STAFF Jul 29 '16 at 06:35 PM

This is expected behavior. The Hit Item returns -1 because there are not additional items within the hit actor to express.

(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