I’ve inherited a VRExpansion plugin based project to which I need to add functionality without changing the original code significantly. I basically want to get button and trigger event info from the Vive motion controller to implement a supervisory function to activities in the game. I can’t figure out how to get access to those low-level events. Any suggestions?
Use the EnableInput node to bind to the input for a player controller in any other actor, you can have it take over the input or continue to pass them along. Character auto bind to input, but you can read them in the player controller itself as well.
This doesn’t seem to work. My actor is spawned (SpawnActor) in a level blueprint. That actor’s event graph blueprint has a Event BeginPlay thread that executes EnableInput with the GetPlayerCharacter and GetPlayerController functions as inputs. In that same event graph I have an MotionController (L) Trigger event, but it never fires. I get a console message saying “LogLevel: Warning: EnableInput on a LevelScript actor can not be specified for only one PlayerController. Enabling for all PlayerControllers.” but I’m not sure if it’s relevant. I suspect the game’s existing character is taking input back after my EnableInput, but not sure how to correct this. My goal is to basically monitor hand controller button presses, regardless of what existing inputs may be enabled by other actors or characters.
Why don’t you just check in the player controller itself? Player controller has input priority over the level script and over the pawn.
The player controller class is derived from your VRPlayerController. There is no code in the derived class or VRPlayerController that specifically enables input, probably because, as you say, player controller has input priority over everything. Where would you suggest I wrestle control from the controller so an actor can see those hand controller input switches since my spawned actor is clearly not the place?
Player controllers always enable input, you can literally just call the events but have them set to not block to the character.
That’s what I thought, but, for whatever reason, these input actions just don’t get triggered in my actor that is spawned in the level blueprint. I even tried triggering off the spacebar but it wouldn’t trigger either. While looking for a possible cause, I noticed in the blueprint editor’s details tab a section entitled “Inputs” with a variable “Auto Receive Input” that is set to “Disabled”. So I set its value to “Player 0” and now I get keyboard inputs, event without a call to Enable Input, but still don’t get events from the Vive motion controller switches. I’m definitely missing something.
Oh wait, I found the problem. This is embarrassing. My Vive controllers are incorrectly labelled left and right, so the one I was holding was not the one I was listening for. Sorry to waste your time. Really appreciate your assistance. Thanks.