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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How do I get the RGB value of a mesh at runtime?

I've got a static mesh which is using a dynamic material instance and timeline to change the colour. Depending on what the colour is when the player hits it will change what the mesh will do.

For the sake of simplicity, I'm only using blueprints and pure red and blue colours.

To make this work, I need to know what the RGB value of the mesh is when the player hits the collision mesh.

How would I go about finding this out at runtime?

Product Version: UE 4.22
Tags:
more ▼

asked May 04 '19 at 02:04 PM in Rendering

avatar image

SteveDM
3 2 3

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

2 answers: sort voted first

You Set the material parameter, you can Get it the very same way - that's your colour.

alt text

capture.png (89.9 kB)
more ▼

answered May 04 '19 at 04:25 PM

avatar image

Everynone
14.6k 76 25 61

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

The most simple way would be to query the timeline rather than the mesh itself. As your timeline updates, update a Vector variable too with the RGB value and when the mesh is hit, just check the value of that vector.

Personally I'd add all this within an Actor Component as it'll be easy to reuse across many actors.

more ▼

answered May 04 '19 at 03:19 PM

avatar image

phil_me_up
1.5k 6 6 12

(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