Category: Blueprint / C++ Nodes


Gameplay & Collision


On this page:


1. Query Paint Collision

Use this node to quickly find out whether the pixels around a world location carry any collision tag of interest, for a given mesh. If a matching collision tag was found, this function returns true, otherwise it returns false.

This allows you to build gameplay systems that react to painted areas. Eg: Pixels carrying damage for A.I. (i.e. traps), behavior cues (eg: telling the A.I. to jump), Portals (for projectiles or characters to pass through), etc. Collision tags are created for pixels at the time of painting effects (see Paint Functions)

For complex gameplay scenarios such as evaluating multiple collision tags with filters/constraints, you should use Query Paint Collision Multi instead.

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::QueryPaintCollision
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Primitive Any primitive (mesh/landscape-component) for which paint collision is to be tested. Typically you will supply this via generic collision events without knowing the exact primitive yourself. UPrimitiveComponent*
Collision Tag The collision tag to look for. Remember to use exactly the same collision tag you passed into the system earlier in the Paint Stroke node!  FName
World Location The world location on this primitive where collision is to be tested.  FVector
Minimum Paint Blob Size This is the minimum blob/collision size this query needs to succeed. Eg: An A.I. may query for a Portal of a certain minimum size to ensure it can believably pass through.  float
 Collision Inflation Scale Scales the size of the painted collision used for evaluating this query. Typically the correct place to do this is while painting the stroke itself as you have more context of the overall effect there.  float
 Collision Inflation In Absolute Units Collision Safety Net. Inflates the painted collision in world-space units. Very useful for projectiles, etc that need additional margin for believable collision effects. float

 


2. Query Paint Collision Multi

Execute complex collision queries across multiple collision tags with support for filters, bucketing of duplicate collision tags by distance brackets and more. Returns true if any matching collision was found, along with the first collision query that successfully matched your collision criteria.

This allows you to orchestrate complex gameplay scenarios such as allowing A.I. to react differently to painted areas depending on their size/etc. The best example for this is the sample project’s “Character Interaction – Floor Pit” (Item 3 in Paint Collisions) where players are allowed to dig holes of different sizes on a wooden floor and the A.I. responds to small holes by jumping over them and to large holes by simply falling into the pit.

This is achieved by creating multiple queries for the same collision tag that each specify different minimum collision blob sizes that they’re interested in.

Here’s what the node looks like:

And here’s what the collision tag query structure looks like:

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintStrokeAtComponent
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Primitive Any primitive (mesh/landscape-component) for which paint collision is to be tested. Typically you will supply this via generic collision events without knowing the exact primitive yourself.  UPrimitiveComponent*
Collision Tags List of Don Paint Collision Queries. Each query has configurable collision filters in it. You can create multiple queries for the same collision tag! The sample project uses this technique to make A.I bots jump across small-sized holes and fall into large-sized ones.
[Blueprint tip] drag a wire from this parameter, type “Make Array”, and then “Make DonPaintCollisionQuery” to rapidly setup your queries.
FDonPaintCollisionQuery
Out Collision Tag The first matching collision query that succeeded. Use this to drive gameplay decisions by testing which collision tag succeeded, and also which specific filters it passed with. FDonPaintCollisionQuery
World Location The world location on this primitive where collision is to be tested.  FVector

 


Text Functions


On this page:


1. Paint Text

Paint text from UMG/Slate onto a mesh or landscape using a Hit result as input. Use this to stamp text guided by collision impacts, player interaction, etc. If you already know exactly where to stamp the text beforehand (Eg: Shirt names/numbers) use Paint Text At Component instead.

Only materials which have a Don UV node for the specified paint layer are eligible to receive the effect. Conversely, if you have a master material which is setup to receive paint(/text), but want one of your child materials to be excluded, check out the Disabling Paint Layers On Material Instances page.

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintText
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Hit Any Hit Result from collision impacts, mouse/cursor hits (projected to world) or any other source.  FHitResult
Text The text to paint. Can be obtained from UMG, Slate or even constructed inline in a Blueprint (LiteralText) or C++ (NSLOCTEXT),  FText
Style Use this to set your Font, Font Size and other text properties. FDonPaintableTextStyle
Color The color of your text. Typically you will just want to use this as a _mask_ and drive your actual text color inside the material.

Note:- Alpha channel does not contain any information/mask for text because of the way it is rendered.

 FLinearColor
Rotation The rotation of your text projection. If you’re using a Mesh UV workflow (characters/etc), then the UV Islands of your UV map will influence the actual rotation. int32
 Paint Layer The paint layer onto which text is to be projected. Each paint layer is a separate texture.

Typically each text needs a dedicated layer as text-material-render doesn’t support alphas.

 int32

 


 

2. Paint Text At Component

While Paint Text requires you to supply a Hit Result, there are times when you already know exactly what component/socket to target for stamping your text. Use Paint Text At Component for that.

Typical example is stamping shirt names or shirt numbers for characters; because the location of the shirt name/number is (typically) fixed, you can use this function and pass in a target socket directly.


For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintTextAtComponent
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Primitive Component The primitive onto which you desire to paint an effect. Typically a skeletal mesh or a static mesh.  UPrimitiveComponent*
Relative Location The _relative_ location on your mesh for this paint stroke. Ignored if SocketName is also set. Hint:- This is a relative space, not world space location. FVector
Text The text to paint. Can be obtained from UMG, Slate or even constructed inline in a Blueprint (LiteralText) or C++ (NSLOCTEXT),  FText
Style Use this to set your Font, Font Size and other text properties. FDonPaintableTextStyle
Socket Name Specify a socket instead of relative location. Convenient for targeting specific limbs or body parts directly.

Note:- Socket must be accurately placed at the desired part of your mesh for the effect to be rendered precisely.

FName
Color The color of your text. Typically you will just want to use this as a _mask_ and drive your actual text color inside the material.

Note:- Alpha channel does not contain any information/mask for text because of the way it is rendered.

 FLinearColor
Rotation The rotation of your text projection. If you’re using a Mesh UV workflow (characters/etc), then the UV Islands of your UV map will influence the actual rotation. int32
 Paint Layer The paint layer onto which text is to be projected. Each paint layer is a separate texture.

Typically each text needs a dedicated layer as text-material-render doesn’t support alphas.

 int32

Paint Functions


On this page:


1. Paint Stroke

For most users, this is the only node you’ll ever need.

Simply pass in a HitResult from your gampeplay or player interaction and this will render an effect for your Hit Location.

To actually receive the effect inside your materials, you’ll need to use one of the material functions provided by the plugin (see Choosing the right UV workflow for your Mesh).

Depending on which material function you choose, your stroke may be rendered onto a single texture (shared world space painting) or onto a unique texture for each mesh in your actor (mesh space / local space painting).

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintStroke
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Hit Any Hit Result from collision impacts, mouse/cursor hits (projected to world) or any other source.  FHitResult
Brush Size The radius of your paint stroke measured in World Space units.
The actual brush size rendered is UV Island dependent in some secnarios such as decal/text projection in a mesh-space UV workflow.
 float
Brush Color  The color of your brush stroke.  FLinearColor
Brush Decal Texture Optional Decal. The decal texture is expected to have the decal in RGB and the decal mask in its Alpha channel.

Both can be used inside your material for specific effects. 

 UTexture2D*
Paint Layer Paint Layers are used to drive multiple effects that are independent of each other. Each paint layer is a unique texture onto which a single effect may be painted as RGB with an Alpha mask (or even multiple effects with individual R, G, B channel masks). A primitive can accommodate multiple paint layers for each material that are all independent of each other.  int32
Collision Tag  Use this to encode your paint stroke with a special collision tag that you can read back later to drive gameplay decisions, custom collisions, etc
You will need to pass the same value back to the QueryPaintCollision (url) node to check whether a particular location has been painted/tagged.
FName
Brush Opacity  The opacity of your paint stroke  float
Brush Hardness The hardness of your paint stroke, 0 = Soft, 1 = Hard  float
Brush Decal Rotation The rotation of the decal projected onto your mesh. For Mesh UV workflows rotation of your UV Island may influence actual rotation.  int32
Brush Render Material Defaults to “M_PaintBrush_Regular” which is an AlphaComposite brush meaning the RGB contains your paint/decal while the Alpha accumulates your paint mask & opacity. If you’re looking to pack R, G, B channel mask effects, just set this to the “M_PaintBrush_Regular_Additive” material provided in this plugin’s Content folder.

Most users will not need to create their own render brush, but you can do so if desired.

 UMaterialInterface*
Allow Duplicate Strokes Important for Decals, Gameplay effects, etc! By default the plugin allows you to keep accumulating or overwriting paint strokes on a single region.  Sometimes, however it is desirable to prevent players from being able to repeat a stroke on a location that has already been painted. Set this to false to achieve that. Eg: Painted Gameplay Items (like traps), Portal effects (eg: Exploding floors that leave holes behind them), Character Decal Tattoos that should only appear once, etc.  bool
Collision Inflation Scale Scales the paint collision associated with this stroke. Useful for Masked materials where your material’s “Opacity Mask Clip” affects perceived collision. As many collidable effects like Portals tend to use soft brushes or low opacity clip masks (to allow for crater WPO effects, etc to be visible…), the size of the observed hole/collision perceived by the player is potentially _smaller_ the actual brush size (collision size) at which you painted the portal!  float

 


2. Paint Stroke At Component

While Paint Stroke requires you to supply a Hit Result, there are times when you already know exactly what component to target and just want to apply an effect at a pre-determined location. Use Paint Stroke At Component for that.

This is great for orchestrating effects; Eg: when a character walks over a Lava trap you can splash the character’s legs with Lava (the sample project has this very example in it!)

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintStrokeAtComponent
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Primitive Component The primitive onto which you desire to paint an effect. Typically a skeletal mesh or a static mesh.

For direct landscape painting the “Paint World Direct” node is recommended for ease of use.

 UPrimitiveComponent*
Relative Location The _relative_ location on your mesh for this paint stroke. Ignored if SocketName is also set. Hint:- This is a relative space, not world space location. FVector
Socket Name Specify a socket instead of relative location. Convenient for targeting specific limbs or body parts directly.

Note:- Socket must be accurately placed at the desired part of your mesh for the effect to be rendered precisely.

FName
Brush Size The radius of your paint stroke measured in World Space units.
The actual brush size rendered is UV Island dependent in some secnarios such as decal/text projection in a mesh-space UV workflow.
 float
Brush Color  The color of your brush stroke.  FLinearColor
Brush Decal Texture Optional Decal. The decal texture is expected to have the decal in RGB and the decal mask in its Alpha channel.

Both can be used inside your material for specific effects.

 UTexture2D*
Paint Layer Paint Layers are used to drive multiple effects that are independent of each other. Each paint layer is a unique texture onto which a single effect may be painted as RGB with an Alpha mask (or even multiple effects with individual R, G, B channel masks). A primitive can accommodate multiple paint layers for each material that are all independent of each other.  int32
Collision Tag  Use this to encode your paint stroke with a special collision tag that you can read back later to drive gameplay decisions, custom collisions, etc
You will need to pass the same value back to the QueryPaintCollision (url) node to check whether a particular location has been painted/tagged.
FName
Brush Opacity  The opacity of your paint stroke  float
Brush Hardness The hardness of your paint stroke, 0 = Soft, 1 = Hard  float
Brush Decal Rotation The rotation of the decal projected onto your mesh. For Mesh UV workflows rotation of your UV Island may influence actual rotation.  int32
Brush Render Material Defaults to “M_PaintBrush_Regular” which is an AlphaComposite brush meaning the RGB contains your paint/decal while the Alpha accumulates your paint mask & opacity. If you’re looking to pack R, G, B channel mask effects, just set this to the “M_PaintBrush_Regular_Additive” material provided in this plugin’s Content folder.

Most users will not need to create their own render brush, but you can do so if desired.

 UMaterialInterface*
Allow Duplicate Strokes Important for Decals, Gameplay effects, etc! By default the plugin allows you to keep accumulating or overwriting paint strokes on a single region.  Sometimes, however it is desirable to prevent players from being able to repeat a stroke on a location that has already been painted. Set this to false to achieve that. Eg: Painted Gameplay Items (like traps), Portal effects (eg: Exploding floors that leave holes behind them), Character Decal Tattoos that should only appear once, etc.  bool
Collision Inflation Scale Scales the paint collision associated with this stroke. Useful for Masked materials where your material’s “Opacity Mask Clip” affects perceived collision. As many collidable effects like Portals tend to use soft brushes or low opacity clip masks (to allow for crater WPO effects, etc to be visible…), the size of the observed hole/collision perceived by the player is potentially _smaller_ the actual brush size (collision size) at which you painted the portal!  float
Draw Debug Location Useful for visualizing exactly where the system is attempting to add paint. Use this for debugging your socket / relative location accuracy.  bool

 

 


3. Paint World Direct

Context-free world-space painting along any two axes. This node paints a shared world-space texture along XY or XZ or YZ directly, without the need to specify an actor or primitive as a context.

Typically used for driving Global Effects like Fog-Of-War systems. Can also be used for direct landscape painting if you’re trying to orchestrate a predetermined effect and just need a quick way to paint a world-space aligned texture.

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintWorldDirect
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

World Location The world location onto which paint is to be accumulated (and potentially used by several interested actors/effect-systems/materials). FVector
World Axes WorldAxes – Choose from XY or XZ or YZ axes for accumulating paint. Because this is planar mapping, you only control two axes; Eg: Painting on XY you lose control over Z axis, i.e. world height.  EDonUvAxes
Brush Size The radius of your paint stroke measured in World Space units.
The actual brush size rendered is UV Island dependent in some secnarios such as decal/text projection in a mesh-space UV workflow.
 float
Brush Color  The color of your brush stroke.  FLinearColor
Brush Decal Texture Optional Decal. The decal texture is expected to have the decal in RGB and the decal mask in its Alpha channel.

Both can be used inside your material for specific effects.

 UTexture2D*
Paint Layer Paint Layers are used to drive multiple effects that are independent of each other. Each paint layer is a unique texture onto which a single effect may be painted as RGB with an Alpha mask (or even multiple effects with individual R, G, B channel masks). A primitive can accommodate multiple paint layers for each material that are all independent of each other.  int32
Collision Tag  Use this to encode your paint stroke with a special collision tag that you can read back later to drive gameplay decisions, custom collisions, etc
You will need to pass the same value back to the QueryPaintCollision (url) node to check whether a particular location has been painted/tagged.
FName
Brush Opacity  The opacity of your paint stroke  float
Brush Hardness The hardness of your paint stroke, 0 = Soft, 1 = Hard  float
Brush Decal Rotation The rotation of the decal projected onto your mesh. For Mesh UV workflows rotation of your UV Island may influence actual rotation.  int32
Brush Render Material Defaults to “M_PaintBrush_Regular” which is an AlphaComposite brush meaning the RGB contains your paint/decal while the Alpha accumulates your paint mask & opacity. If you’re looking to pack R, G, B channel mask effects, just set this to the “M_PaintBrush_Regular_Additive” material provided in this plugin’s Content folder.

Most users will not need to create their own render brush, but you can do so if desired.

 UMaterialInterface*
Allow Duplicate Strokes Important for Decals, Gameplay effects, etc! By default the plugin allows you to keep accumulating or overwriting paint strokes on a single region.  Sometimes, however it is desirable to prevent players from being able to repeat a stroke on a location that has already been painted. Set this to false to achieve that. Eg: Painted Gameplay Items (like traps), Portal effects (eg: Exploding floors that leave holes behind them), Character Decal Tattoos that should only appear once, etc.  bool
Collision Inflation Scale Scales the paint collision associated with this stroke. Useful for Masked materials where your material’s “Opacity Mask Clip” affects perceived collision. As many collidable effects like Portals tend to use soft brushes or low opacity clip masks (to allow for crater WPO effects, etc to be visible…), the size of the observed hole/collision perceived by the player is potentially _smaller_ the actual brush size (collision size) at which you painted the portal!  float
Perform Network Replication Special option to support things like FoW systems where each _local_ player needs a different/unique perspective and therefore, a non-replicating paint FX.  bool