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 affect a material based on collision?

Hello,

I was wondering how I could go about adding dynamic functionality to a shader. For instance, let's say I wanted a force field shader that would create a flash and ripple based on a collision location? So I could throw the force field shader on, say, a sphere and then shoot the default weapon at it and display a ripple/flash everywhere the projectiles hit.

Can anyone point me in the right direction?

Thanks!

Product Version: Not Selected
Tags:
more ▼

asked Dec 15 '14 at 09:00 PM in Rendering

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

1 answer: sort voted first

Hello camelotvfx,

In order to achieve the effect you would like, you will first need to have your object (projectile) generate hit events. When this object registers a hit on whatever surface it collides with (your force field), you can spawn a particle system to sort of 'flash' in front of the user. You can then get the nearest vertex on your surface in which the material is applied and have a sort of 'wave distortion' move across the surface.

This would be the more simplified and quicker solution to your question. It will effectively fake the effect you are going for, but will not be perfectly accurate. Currently there is no known way to get the exact location of collision between your two objects and translate that number to a material effect through blueprints. The more difficult and more math intensive way would be to program this into code, and use vector math to get your exact collision and apply a material effect that way.

Here is some really helpful documentation on collision and how the engine handles certain collision types.

Collision Documentation https://docs.unrealengine.com/latest/INT/Engine/Physics/Collision/index.html#commoncollisioninteractions

Here is some more information on using a physical material for collision as well.

Physical Material Documentation https://docs.unrealengine.com/latest/INT/Engine/Physics/PhysicalMaterials/PhysMatUserGuide/index.html

You also might be able to find some more information on the Unreal Engine Forums because there are a lot of great users on there doing some really cool and unique work. They are experienced and are generally very willing to share their information and tips on how to go about designing certain aspects of their games.

I hope this gets you on the right path. You might feel a bit overwhelmed at first because what you are trying to do is not a simple task. I would suggest going step by step of each process and attempt to understand the question 'Why?' to each one. If you are able to answer the question of why, then you will be able to set up things more freely and with greater control. This will ultimately give you the exact outcome you are looking for, but just be prepared to learn!

Cheers,

Andrew Hurley

more ▼

answered Dec 15 '14 at 10:54 PM

(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