# How can I get the material index that was physical hits?

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197>\
**Category:** Blueprint\
**Tags:** hit-result, unreal-engine, hit-event, question\
**Created:** [February 21, 2025, 9:18am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197 "2025-02-21T09:18:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chofuqiushan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@chofuqiushan](https://forums.unrealengine.com/u/chofuqiushan)\
**Post date:** [February 21, 2025, 9:18am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/1 "2025-02-21T09:18:28Z")

</div>

> [@Trouble with Get Material From Collision Face Index](https://forums.unrealengine.com/t/trouble-with-get-material-from-collision-face-index/231532/4):
>
> Thank you, learning that trace complex is required just saved me a bunch of confusion.

I found a way to get the material from the Face Index with line tracing. I want to do the same with component hit but Face Index always returns 0.  
I’m using a static mesh and have set it to complex collision but the result remains the same.

Does anyone know how to do this?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 21, 2025, 10:23am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/2 "2025-02-21T10:23:57Z")

</div>

> [@chofuqiushan](#):
>
> I want to do the same with component hit but Face Index always returns 0.

When you trace, you **always** trace against components since actors have no collision capability. `Hits Results` return Actors references because the component they own was hit.

Could you clarify?

* * *

See if this works for you:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/2/4f2ecc32a9fea1e366a63748ecb3641655821bfb.jpeg)

> [@chofuqiushan](#):
>
> using a static mesh and have set it to complex collision

You can keep it as `Simple & Complex` - this will allow you to trace against triangle and use the simple collider for other queries.

* * *

Afair, `GetHitResultsUnderCursor` does not work for this - perhaps that’s the issue?

---

<div class="post-metadata">

**Author:** ![chofuqiushan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@chofuqiushan](https://forums.unrealengine.com/u/chofuqiushan)\
**Post date:** [February 21, 2025, 10:58am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/3 "2025-02-21T10:58:43Z")

</div>

I mean, the component hits and trace hits share the same Hit Result output. I thought that if the material index can be obtained by line tracing, it can be obtained by component hit in the same way.  
But for some reason it didn’t work…

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 21, 2025, 11:07am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/4 "2025-02-21T11:07:56Z")

</div>

> [@chofuqiushan](#):
>
> I mean, the component hits and trace hits share the same Hit Result output.

Not sure what you mean by this. There’s nothing to be shared, it’s a struct containing trace result data, nothing more.

* * *

In the anim above, the `Face Indexes` are returned correctly when the trace hits a component - is this not what you’re asking about? I followed up on this:

> component hit but Face Index always returns 0.

If the above does not help, provide more info.

---

<div class="post-metadata">

**Author:** ![chofuqiushan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@chofuqiushan](https://forums.unrealengine.com/u/chofuqiushan)\
**Post date:** [February 21, 2025, 11:46am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/5 "2025-02-21T11:46:17Z")

</div>

I think there was some confusion because there was an edit while replying. Sorry.

This is what I wanted to do.

 ![ComponentHit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/f/c2f3b1a9e49d162fb3763f648b4cff772bb84689.png)  
As you say, the structures were the same so I would have thought that the material index would be obtained in the same way. Because I thought they were returning the same type of information.

But the Face Index is still 0. I’ve tried this with complex and simple collision on both the hitter and hit side, but nothing works. I don’t intend to use line tracing.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 21, 2025, 12:28pm UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/6 "2025-02-21T12:28:49Z")

</div>

> [@chofuqiushan](#):
>
> I don’t intend to use line tracing.

And that’s where our wires crossed. My bad. What generates this collision event? In case of physics, for example, the collision would not return Face index - that’s afaik. Since it revolves around simple collision only. Technically, you should be seeing -1, rather than 0.

I feel you will need to perform an additional `complex` line trace based on the initial hit.

---

<div class="post-metadata">

**Author:** ![chofuqiushan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@chofuqiushan](https://forums.unrealengine.com/u/chofuqiushan)\
**Post date:** [February 23, 2025, 6:12am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/7 "2025-02-23T06:12:06Z")

</div>

Hit doesn’t detect complex collisions? That seems to be the reason it didn’t work…  
Thanks for helping me solve the question. I’ll try line trace.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 25, 2025, 6:12am UTC](https://forums.unrealengine.com/t/how-can-i-get-the-material-index-that-was-physical-hits/2348197/8 "2025-03-25T06:12:48Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
