I want to write a VR game with pure C++.
I didn’t find a official tutorial on this topic, and not works with many different kinds of codes combinations trying…
Your “Controller” is a UMotionControllerComponent.
You can give your Character/Pawn a set of these for the hands. The MotionControllers can then have USphereComponents for collision detection; when the player has reached into something.
Something like:
Character
MotionController_LeftHand
LeftHandMesh
LeftHandCollision
OnOverlap
LeftOverlap(true)
LeftOverlapping = OtherActor
OnEndOverlap
LeftOverlap(false)
LeftOverlapping = nullptr
MotionController_RightHand
RightHandMesh
RightHandCollision
OnOverlap
RightOverlap(true)
RightOverlapping = OtherActor
OnEndOverlap
RightOverlap(false)
RightOverlapping = nullptr
Input
RightTriggerDown
Character->IsRightOverlap( )
Character->RightOverlap->Pickup( )
RightTriggerUp
Character->IsRightHolding( )->Drop( )
LeftTriggerDown
Character->IsLeftOverlap( )
Character->LeftOverlap->Pickup( )
LeftTriggerUp
Character->IsLeftHolding( )->Drop( )
The Blueprint VR example is a good example of how to manage the components for UMotionControllerComponent/UMeshComponent/USphereComponents.