Mars Marine - Thumbstick Aiming

We want to support gamepads in Mars Marine. So in this lesson, we cover setting up the thumbstick aiming!

Are you following this section with the gamepad? It would be great to hear!

If you are super keen on all the nitty-gritty math details, Ben’s upcoming Math for Games course is something you should be checking out!

Post any questions relating to this lecture below!


I’m having a hard time using a Ps4 controller. When using an Xbox one controller everything works fine for the left thumb stick but not for the right thumb stick. It is a new controller so i’m not sure why.

1 Like

PS4 Controllers don’t typically work on PC(drivers and all that) you can download a free program called DS4Windows and your PS4 controller will work now. Hope this helps :grinning:

Exact same issue for me. Hoping this doesn’t screw me up moving forward for the resat of the project.

Edit: it is working now, I did not realize at this point in the lesson we weren’t yet supposed to be able to rotate. Not really clear in the videos, but all good.

I don’t own a ps4 or xbox one controller, but i own a nintendo switch. Does this work with the Nintendo Switch controllers?

I know this is really late but for anyone else that stumbles on this. Yes, the Nintendo Switch controller should work. However, you made need to get a developer license with Nintendo and download the version of UE with Switch support before it works.

Your mileage may vary.

Is it possible to map both movement and rotation/aim to the left stick so the Marine faces and aims in the direction of movement?

Short answer, yes!

Longer answer, it’s definitely possible but I don’t know the steps needed to do it. Though you can probably look at the top-down template in Unreal Engine to have an idea.

1 Like

Challenge accepted. It’s not a great mechanic but here’s the necessary changes. Have to say it is a good example of bad controls.

Update these

To These

Awesome, will havea crack at this and see how it goes!

This seemed to do the trick, and yeah, you’re right, evading enemies while only able to shoot forwards is not ideal! Looks like the idea for a one stick free roaming shooter might need a rethink!

I realise this is beyond the scope of the course, but if you have any pointers on how to adapt the aiming code to work with enhanced input actions it would be greatly appreciated!

Not at the moment. I’ve not really looked at the enhanced input and honestly, barely at UE5.2.

1 Like

Is it possible to adapt the right stick aiming for touch?
Everything works great with keyboard and mouse (and left touch stick movement works fine as is using the default touch thumbsticks and ‘use mouse for touch’ enabled in project settings) but the right touch stick doesn’t control the aim for some reason. There are so many nested functions in this control system I’m not quite sure the best way to solve this.

I’m not sure how you use touch with Unreal but it is possible, that much I’m sure. I’m assuming you are talking about mobile here.

Yes, basically this method;

Works out of the box for left stick, but not for right.

1 Like

Shouldn’t be too hard to get it going. may just me a case of mapping the inputs

Had a bit of a dig. It should be coming through as gamepad stick Right Y and X so should work. It doesn’t however and I tried in 4.26 so is not a UE5 issue either. I saw somewhere that the input needs to be handled in the game mode but that makes zero sense to me.
Sorry I don’t have anything more helpful.

1 Like

No worries, thanks for investigating.

Privacy & Terms