摘要
How do I create a new custom c++ class which inherits from ControlRig
?
Copy from:
https://gamedev.stackexchange.com/questions/211984/how-to-create-custom-control-rig-class-in-c
First add the following modules to the <project-name>.Build.cs
file:
1 | PublicDependencyModuleNames.AddRange(new string[] { |
Then rebuild your project, since I’m on linux using the pre compiled Unreal Engine I use the following command:
1 | cd /path/to/Engine/Build/BatchFiles/Linux/ |
1. Creating a custom Control Rig
class
Here’s the template to create a custom control rig class:
*CustomControlRig.h*
1 |
|
*CustomControlRig.cpp*
1 |
|
You can override the Initialize()
& Execute()
methods and add your logic.
You can conditionally check the InEventName
to see if it’s Forwards Solve
or Backwards Solve
You can also use it as a parent class for your blueprint since we added UCLASS(Blueprintable)
:
2. Creating custom nodes
Incase you want to create reusable nodes inside the rig graph editor you can use the following template
*RigUnit_CustomNode.h*
1 |
|
*RigUnit_CustomNode.cpp*
1 |
|
(Note: Unreal is strict with the naming convention so name your rig unit class as such FRigUnit_<name>
)
If all is done properly you should see your node in the rig graph editor as such: