Vive Teleporter in C++
I've been programming a long time and I must admit the teleport blueprint example from Unreal is very intimidating. Converting this to C++ feels like a major task
It reminds me of an airplane cockpit:
Well... with anything big, you eat it one bite at a time.
The first bite was getting VIVE controllers into my game in C++. That was easier than I thought and covered in a prior post.
The second bite is firing off my C++ code when buttons are pressed.
This is a great article on doing this:
http://jonaskunze.com/accessing-htc-vive-controllers-from-c-in-ue4-4-13-and-4-14/
I don't want to break the existing teleport example in Unreal so I have to figure out which buttons are already mapped and use event names instead of the ones in that example. Eventually I will rename the event names to be generic but that will be a last step in the process.
I think this image is very helpful:
I compared the button mappings in my current DefaultInput.ini, to what that article listed. Here is what I have:
Action Mappings:
TeleportRight (RightTouchpadPress) = MotionController_Right_Thumbstick
TeleportRight (RightTouchpadUp) = MotionController_Right_FaceButton1
GrabLeft (LeftTrigger) = MotionController_Left_Trigger
GrabRight (RightTrigger) = MotionController_Right_Trigger
TeleportLeft (LeftTouchpadPress) = MotionController_Left_Thumbstick
TeleportLeft (LeftTouchpadUp) = MotionController_Left_FaceButton1
HMDTeleport
Axis Mappings:
TeleportDirectionUp = Gamepad_LeftY
TeleportDirectionRight = Gamepad_LeftX
MotionControllerThumbLeft_Y (LeftTouchpadY) = MotionController_Left_Thumbstick_Y
MotionControllerThumbLeft_X (LeftTouchpadX) = MotionController_Left_Thumbstick_X
MotionControllerThumbRight_Y (RightTouchpadY) = MotionController_Right_Thumbstick_Y
MotionControllerThumbRight_X (RightTouchpadX) = MotionController_Right_Thumbstick_X
The name on the left is what the Unreal teleport example calls it.
The name in parens is what the article calls it.
The value on the right is the actual action/axis event.
To start with, I am going to use these and add methods for each of them in my Pawn code. It recommend a Character class. Character just extends Pawn and adds more human locomotion logic. If I need to, I will change my base class to Character, but for the moment I am sticking with Pawn.
This was a reddit post discussing Pawn vs Character for reference:
https://www.reddit.com/r/unrealengine/comments/2yo13c/a_question_on_the_acharacter_vs_apawn_conundrum/
No comments:
Post a Comment