Controlling 2D character in game

Hi all. I’ve not used UE in a while, and I’m working on making a little VR game for Vive. I’m new to the enhanced input actions, so I think this is where I’m failing.

I’m starting with the VR template, UE 5.5.1. I have my default VR Pawn that will be able to move around the space (just teleportation basically, all done on the right hand controls) and there will be a 2D character within the map that I need to control using the left controls on the Vive (just simple 2D actions, move, jump…)

I put the IA controlling the right hand movements in the VR_Pawn BP, and the IA for the left controls in the 2D character BP. VR is working fine, but I cannot get the 2D character to move, jump etc. Do I need to specify somewhere that that these controls should affect a different object in the scene? If it makes a difference, the 2D ‘character’ is currently just a basic static mesh component added to a character BP.

Appreciate any help with this - it’s been driving me crazy and it’s probably something simple that I’m missing.

Yep :innocent:

Inside the character’s blueprint, you should have this setup:

Hope this helps!

Thanks! Sorry if this is painful, but would I need to add something in the VR_Pawn BP, to possess the 2D character? Here’s the 2D character BP - the highlighted IMC_2D is for the jump actions- I didn’t think it wise to put them in with the default IMC.

Thanks again for your help.

Oh you want to control both at the same time, I see.

In that case, you might wanna check this post out!

Thanks, there’s some good info there. I’m still struggling to get the 2D character to respond to any inputs, though. I wonder if this problem is specific to the VR pawn, with the difference in the way the controller is handled? Since it’s technically two controllers? The post that you directed me to is more than ten years old, so pre or very early VR dev days.

Hey there @replica101! Sorry for the delay, I was just able to launch my PC for the weekend. I wanned to test it myself before replying.

Could you share your attempt on the implementation provided? I was able to reach the expected result upon implementing the blueprint code exactly.


Alternatively, you can manually place the character into the scene, then while it’s selected on the viewport or outliner, head to the level blueprint like this:

Right click on an empty space on the Event Graph and click on the “Create a Reference to [Example]” button on the menu that pops up, and use that as the target like this:

And here’s the result of both approaches:

(In my case, I’m controlling the player character with keyboard inputs and the second character with the mouse inputs)*

Hope this helps! :blush:

1 Like

Hey there @replica101, it’s been a while since we last heard from you! Did you get to try my last suggestion? Do you have any updates to share?

Thanks! This was really helpful, I was just missing a couple of steps along the way. Sorry for the delay in responding - appreciate your help :slight_smile:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.