About 'Extracting A Hand Controller Actor'!

  • Why should hand controllers be actors?
  • Spawn actors on BeginPlay.
  • Move UMotionControllerComponent into Actors.
  • Fix other build errors.
  • Create a Blueprint child actor.

(Unique Video Reference: 21_AE_VR2)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

How would I mirror the Oculus controller for the right hand now that I can’t access the static mesh in the cpp file?

i also faced the problem to mirror my oculus controller

i added a function under the HandController.cpp

void AHandleController::SetMirrorHand()
{
UStaticMeshComponent* controllerMesh = this->FindComponentByClass();
controllerMesh->SetWorldScale3D(FVector(1, -1, 1));
}

and called it after creating the right controller in the VRCharacter - this solution actually mirrored the controller but created another problem that inverting the normals of the mesh caused the texture to appear inside out:

when i set the scale -1 during runtime - its working fine.
from the code it causing this problem - please assist.

the only other option i know is to create a separate BP for the right controller.

Double click on the material for the oculus material and under the General tab in Details, drop down the Material Property Overrides and check both check boxes for Two Sided.

For Unreal Engine 4.23 and above, the EControllerHand is no longer an enum, but an FName. So, when you spawn it from the character.cpp, you have to use:
LeftController->SetHand(“EControllerHand::Left”);

Then, in the HandController.h file, you have to declare:
void SetHand(FName Hand);

And for the definition, use:
void AHandController::SetHand(FName Hand)
{
MotionController->SetTrackingMotionSource(Hand);
}

1 Like

Be sure that the static mesh you add in for the motion controller has the OverlapAllDynamic collision, otherwise the teleport arch will not show up, nor will you be able to walk correctly! Only took me about 5 hours to figure this out once I created the blueprint.