Adding a New Controller
Last updated
Last updated
This guide will assume that you are using the folder structured illustrated below. It doesn't matter where you put the CustomController folder but keep in mind that locating it outside of the VRImmersiveHands folder could be better in case you would want to upgrade to a newer version.
CustomController
MyCustomController
Anim
Materials
Textures
Adding a new controller to the content is rather easy. To add a new controller mesh;
Find the 3D model for the controller. This usually can be found at manufacturer’s website.
Import the 3D model to Blender and make sure scale is correct.
Set units as following.
Separate, rename and parent buttons to Body. Rotate it so forward vector is X+. Name the face button closest to the hand as Button1 and further one as Button2.
Set each button’s pivot properly. Have a look at the Bones of the controller skeletal meshes included in the content for this. A good pivot placement will ease creating pressed button animation. There are tools to only change pivot in Blender. Exporting other skeletal meshes and having a look at them in Blender will help a lot. The 2 most important things are that you get the scale and pivot for the stick right.
Export it.
Import it as Skeletal Mesh and leave Skeleton empty for the first one. If succesful, it will be imported as a Skeletal Mesh and a Skeleton will be created for it. You can use same Skeleton for Left and Right meshes.
Add hint sockets. Have a look at the provided controllers.
Create a mask for every button. Have a look at the provided controllers.
Duplicate Anim_XXX_Idle and name it as Anim_XXX_Pressed.
Create an Anim BP.
Modify the Stick 2D part so that X=1, Y=0 tilts the stick on Y+ axis and X=0, Y=1 tilts the stick on X+ axis.
Settings
Description
Left Controller
A skeletal mesh for displaying as left controller
Left Anim BP
An anim instance for left controller
Right Controller
A skeletal mesh for displaying as right controller
Right Anim BP
An anim instance for right controller
LC Optimized
A static mesh for displaying as left controller
RC Optimized
A static mesh for displaying as right controller
Hint Material L
Hint Material R
Hand Transform
Here comes the hard part. This part will take a long time and patience. You can use Control Rig to create these animations.
Utilize the Using Control Rig - Advanced Level and Bake To Control Rig to create animations.
If you want to show hints on your buttons follow these steps. Have a look at the provided controllers for example.
Hint feature expects the materials to be in a certain order in DT_Controllers.
MI_Hologram_MyCustomController
MI_Hologram_MyCustomController_Culling
MI_Hologram_MyCustomController_DDT
MI_Hologram_MyCustomController_Culling_DDT
MI_Highlight_MyCustomController
Duplicate materials named with MI_Hologram... to your custom hands materials folder.
Create finger masks for you custom hand.
T_MyCustomController_B1_B2_S. B1=Button1 as R, B2=Button2 as G, S=System as B.
T_MyCustomController_M_SH_P. M=Menu as R, SH=Shoulder as G, P=Touchpad as B.
T_MyCustomController_T_G_TS. T=Trigger as R, G=Grip as G, TS=Thumbstick as B.
Set the sRGB value of the masks to false in UE4.
Replace the masks with yours.
Go through each Update Button for each controller button.
Check if your controller’s inputs are mapped in “Project Settings>Input”. If they are not, add them.
Open the Skeletal Mesh and Create Animation from Current Pose. Name it as Anim_XXX_Idle. Where XXX is the name of the controller.
Open Anim_XXX_Pressed, click To Front on timeline and set each button’s transform as though they are pressed. Have a look at other pressed anims for reference. Click Key and Apply after every button so you don’t lose progress. Click Apply and Save when its done.
Add BPI_AnimBP to the Anim BP.
Copy the Interface Events from another AnimBP. Delete the one that your controller doesn’t have.
Copy the Anim Graph nodes from another AnimBP. Change Idle and Pressed anims with new ones. Delete the one that your controller doesn’t have. Make sure bone names are correct in Layered Blend Per Bone.
Open E_HMD and add a new enumerator.
Open DT_Controllers and add a new row. Warning: This have to be same with the one entered in E_HMD.
Fill out hand properties. We will come back to Hand Transform.
Transform for UE4 hand to grab the controller.
Open DT_ControllerAnims, add a new row and fill out animations. Warning: This have to be same with the one entered in E_HMD.
Duplicate your hands material and add this setup to it.