[UE] Click on an object in the scene to generate an introduction label

Effect

 

step

 First create a control blueprint and add the following controls

 Added an animation to the horizontal box control, let the control display for 2 seconds, then move up between 2 and 3 seconds and reduce the opacity

 Play an animation in the chart, remove the control blueprint after a 3 second delay

 Add the following nodes to the player-controlled Pawn

First, use the "Detect Lines by Channel" node to obtain which object in the scene the mouse clicks on

 Get the name of the hit actor when the ray detects the hit result, and then make a judgment

 The "CreateTagOfClickedObject" function node is as follows:

 The variable "ClickedObjectNames" is an array of strings used to store the names of objects that may be clicked.

 If the "Detect lines by channel" node does not detect the clicked object, check whether the collision preset has enabled collision query

If the static mesh has no collision, you can set a convex hull, or add a box collision component, etc.

Guess you like

Origin blog.csdn.net/ChaoChao66666/article/details/131599152