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 can I get the material under the cursor?

So I'm trying to develop a material switcher to allow us to switch through different materials within an architectural model.

I'd like to come up with a fairly general system to do this, and the first part of that is identifying a material to change. I'm trying to get the exact material that a user clicks on, but I can't see a way to get the exact material, since FHitResult only tells me the actor or component, which (As far as I can tell) could have multiple materials applied to them.

Is there a relatively simple way to find what material I've clicked on? Or would it require some overly complex analysis of the actor/component?

Product Version: Not Selected
Tags:
more ▼

asked May 29 '14 at 03:14 AM in C++ Programming

avatar image

Ineni.Realtime
119 28 37 45

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Sadly, there is no easy way to do this that I know of and you'll probably have to dive fairly deeply into the source to achieve what you want.

At the moment, as you've noticed you can get the component, and you can get which materials are applied to that component. If you wanted more detailed information, you'd have to look at the mesh of the component and grab the relevant UV information for the verts you've hit, then get the corresponding material ID. For static meshes this should not be overly difficult (rigged skeletal meshes are an entirely different story, but mercifully this isn't pertinent), but it will certainly require programming if there isn't a nice little feature if it isn't already there.

As a side note, if it isn't there, this would be a nice thing to have exposed to the programmer / blueprint API.

more ▼

answered May 29 '14 at 04:24 AM

avatar image

ambershee
603 23 30 51

avatar image Ineni.Realtime May 29 '14 at 04:33 AM

Just as I feared :\ Well, I suppose if I can figure it out now I don't have to again. Thanks for the help :)

(comments are locked)
10|2000 characters needed characters left
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