top of page
Search
Writer's pictureLiling Liu

[Control Rig] Unreal Engine 5.2 Control Rig 教學 - Head Aim/Look At - # 11 |頭部瞄準 |Tutorial


Head Aim/Look At




Add controller




Roughly, Located in front of the head










Use the Aim node to create the aiming of the head


In order to make the body more natural when aiming, there are settings for Head, neck, and spine.


Change the Traslation of the Aim controller to an individual Target, and adjust the value of Weight according to the character.


*Remember to connect from the body to the head, not the other way around, as this can cause problems.





At this time, drag the Aim controller, and the body to the head will follow the movement.


This time we will use variables so that can interact external objects.


Add new attribute variable: LocationAt Location is Vector, the eyes must be opened, and it can be used later.




Get the World value of LocationAtLocation and link it to the Target of each Aim respectively.



But at this time, you will see that the small panel character of Control Rig is abnormal.





To get the Control Rig panel correct


Add a new variable in Variables: IsLookAt is Boolean, the eyes must be opened, and can be used later.




Make relevant judgments about whether the object is being looked at. If so, the value of LookAtLocation will be used. If not, the value of the controller we created will be preset.



The characters on the Control Rig small panel are normal.





Start blue print settings for objects


Create the BP Actor of the object in Content Drawer




First add Collision, use Sphere collision, and add Mesh that also adjusts the desire position.








Adjust the sphere Radius of Sphere collision to a size. When the character enters this area, an event will be driven










In the Events of Sphere collision, add On Component Begin Overlap and On Component End Overlap









Add attributes to the character's BP

LookAtObj - select the object BP Actor you just created



To the BP Actor Event Graph settings of the object


If the character enters the sphere collision, let the character look at the object, check IsLookAt, and then LookAtObj is the sphere itself, otherwise there is no IsLookAt



Open ABP_XXXXXX file


First, in Control Rig opens the Aim variable. LookAtlocation and IsLookAt use pin



Set parameters in ABP's Event Graph


At the beginning, have the character's information first, and then use Promote so that it can be used repeatedly.



Put the variables of the BP character into ABP, and use the Promote value to let them get it.


IS Look At uses the branch method to determine, if so, perform LookatLocation.

This LookAtLocation is the worldLocation of the object seen by the character.



Back to AnimGraph

Connect Look at location and Is look at to Control Rig.



Use Blend Pose By Boolean to set whether you are viewing




The character is interacting with objects, but the rotation of the head is abnormal and the angle needs to be limited.


Use the character to get the Actor location and the world Location of the object to find the Rotation value you see. The Rotation value and the character Actor Rotation value use Delta(rotation) to get the Z value.


Because turning the head left and right is the Z value.


Add a new property: Look At Offset, set to 85. Adjust according to role

If the value is less than the set value, it is within the range and Promote the value.


*ABS is used here to avoid negative values, so that all negative values ​​are returned to positive values.



Back to AnimGraph


Use AND to judge. If there is an object looking at it and it is within range, perform the True pose action.



At this time, you will find that the small panel character of ABP is unstable and has a crooked head. Moreover, the character in the game is also wrong. No matter how many times you pull the BP character, there will still be problems.


Here you need to set the Offset location additionally.


First, go back to the character’s BP settings.




Set the fake object in the Viewport in front of the character













Keep objects from appearing in the game


Select the object and find Hidden in Game in the properties panel to turn on and it without Collision.



Go to event graph

Let each frame get the World Location and Promote variable of this object



Back to ABP_XXXXX, Event Graph

The AimOffsetLocation Promote variable of the BP role is used by ABP



Place the variable in a location value not seen by AnimGraph, then the character will be normal.






















40 views0 comments

Comments


bottom of page