Get Material On Hit

Ok i admit I’m Desperate,
I have a physic object witch i can grab and move… Let’s say an Axe. My Axe is made from metal (the Top) and wood for the handle. Now as I told before, the axe is subjected to simulate physic, so as you can imagine no possibility to use complex collision option.
I assigned two materials to the axe, one for the metal and one for the wood. To each material i assigned a Physic material but since the collision cannot set up to complex collision, on event hit i always can access only to one physic material for simple collision.
I was sure to have found the the light to the end of the tunnel with the command “get material from collision face index”. But nothing, I always obtain on event Hit just the first material and never the second.
I only manage to detect on event hit Two different Physic material by setting up the option use complex collision as simple.

The question is… Is it possible to detect on event hit two different material index or name applied to one mesh which have to be physic simulated?

As you can imagine what i m trying to replicate is that if the axe collide a wall with the metal part it will be fix on the wall, otherwise if will hit with the wood side it will just collide the wall and fall down on the floor.

Can some one help me? After several ours of research i was not aple to solve the problem.
Thank you in advance

Hey iNSCAPE85,

I’m not sure about your direct question but maybe an indirect solution would be helpful…

Instead of trying to do this by material maybe try doing this with two separate static mesh mesh components. The metal part of the ax being one static mesh component and and handle as another static mesh component. The combine the two as an actor.

You should be able to use the metal component’s ‘On Hit’ event and see if its a wall actor.

Hope this helps!

I thank you for your answer, but i have to say that i already tried your solution, the problem is that two combined meshes in the actor have to simulate physic, so even if you drag the metal part and you attach to the wood part, when you simulate physic both of them they will separate as indipendend object… And if you use a physical constraint the effect is horrible…

You want to make a throwing axe, and only stick the axe into the wall if it’s hit by the metal side?

That’s easy, in the Axe actor blueprint, just make a collision box for the metal head. Then for this collision box, apply a collision event (on event hit), which disables the physics for the whole mesh, thus making it stick in place.

At best, make the collision box only around the sharp knive part of the axe head.

This way, if the axe mesh hit’s the wall with the sharp head, it will stick. If it hits the wall with the wooden handle or the back of the axe knive-head, it will just bounce of the wall, as it should.

EDIT: You don’t need to assign any physics material at all.

In fact launching the axe it was just for example… In the reality the axe is governed by a motion controller and i need to keep the physics on… I just have to launch two different function when i hit with the metal part and when i hit just with the handle part…
And on top of that the vent hit on capsule component doesn t work if simulation physic is not turned on…

You would have the physics turned on, you only disable them after the collision event is triggered (axe gets stuck).

I don’t understand why you can’t disable the physics when the axe get’s stuck, you won’t be able to move it afterwards with the motion controller anymore anyway, no?

Because the axe is still grabbed by my hand… and even if the metal part is fixed, the handle is stil subjected to move of my hand…
Imagine that you fix an axe in a peace of wood… The metal part is fixed in the wood but with your hand you can still turn the handle and you try to apply a force in order to de-fix the axe from the piece of wood.

Ah yeah, I thought that’s the problem. Then you can, on event hit, attach the axe actor to the actor you’re hitting (use the “AttachtoActor” node), and limit the movement to maybe 20 Unreal Units (get hit location as new zero), to create the “wiggle” when of axe when you try to get it out.

Then “hack” a little function, where you have a float and on each “wiggle” of the axe (by the motion controller), you add +1 to that float. Once the float reaches a number (e.g. 10), you detach the axe actor from the “wall actor”, so that you can move it freely again.

This way you wouldn’t need to turn off physics at all.