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"

How to get the correct material on Hit?

Hey guys,

i am currently working on the Bullet impact effects and sounds when hit physics materials. It works well on my Static Meshes that have only one Material. However, if i have Multiple Materials in my Meshes it only returns the First Material. For Example, i have a Wall element with 2 Different Materials, Wood for the Wall itself and Glass for the windows. It would only return Wood.

How do i get the correct material when hitting with traces? Like i said it works well with other Meshes that have only one Material. But if it has multiple Materials it returns just the first Material Element in the list i think...

Product Version: UE 4.11
Tags:
more ▼

asked May 25 '16 at 01:24 PM in Blueprint Scripting

avatar image

ZenRigpa
15 4 4 6

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

2 answers: sort voted first

You need multiple collision primitives for that. Visual materials are applied to visual mesh. RayCheck and similar functions operate on collision meshes, not visual meshes. You could try SimpleFromComplex collision, perhaps if the trace is done against actual geometry you will get individual physics materials assigned to visual materials.

more ▼

answered May 25 '16 at 02:44 PM

avatar image

BoredEngineer
217 10 17 23

avatar image ZenRigpa May 26 '16 at 01:40 PM

I had to use the UseComplexCollisionAsSimple and for the Glass getting to work i had to check the DoubleSidedGeometry. So thank you for putting me in the right direction :-)

avatar image BoredEngineer May 26 '16 at 05:18 PM

Bahh, yeah I meant UseComplexCollisionAsSimple :D

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

first of all Break Hit Result from LineTrace and get FaceIndex , Hit Component. then you need function Get Material from Collision Face Indexalt text

you can get from it value (and name) of hit material, then just check all materials with the same name. In the end you get material index of this static mesh, that you can change in the future.

faceindexmat.jpg (329.8 kB)
more ▼

answered Mar 14 '18 at 08:31 AM

avatar image

6r0m
481 18 17 26

(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