# Player camera Axis Mappings using tilt and rotation

Hi Everyone,

I’m trying to build a system where the mobile device serves as the direction of view for the player controller. The joysticks would be for elevation and forward/back, left/right.

So far I’ve gotten this to report Axis numbers:

Since I’m not well versed in this world of BP, I’m not making the connection from this to actually being able to control the player’s direction with the gyroscope.

So as far as control what I’ve done is set up:

And my character BP is pretty simple.

But when I deploy to iOS the iPad 4 always points down and I have to hold ipad practically upside down to get it to orient semi level. Basically If I put it on the tabletop with screen up the camera looks down. When I hold it up facing me, it still looks down. you get the idea.

I’ve been looking for either templates or SOMETHING to show the right way to set this up.

Anyone know of any resources which can show me the right path? What am I missing here?

Thanks.

Tom

For mobile hardware input values, you’ll have to do some math with the Axis Value to nail your gameplay. For determining this, start by having a little testing setup where you’re using Print String for Axis Value on Event Tick. Physically take the phone and determine how much you’d want a player to have to move around, and write those values down. You’ll have your intended range of motion. Use the values to create an offset of your Axis Value, so it centers where you want. You can use multipliers to decrease/increase your range of motion as well, within the values you determined. And you can have a branch/branches that check if the input is within your determined motion range, and can set a sort of hard limit that prevents the camera from looking beyond a certain point.

While I can certainly assist with visual aid on this, it will first be up to you to determine what range of motion you would like for your players to have.

Right. So from what I’m trying to do is be able to pan around a full 360degx360deg sphere and move in the X and Y (If Z is Up) with the joysticks. In my value return I have Pi, Pi, Pi on an iPad 4 as my full range of motion. What I’m really trying to do is just give the player the ability to look around. That’s it as they move about the premises.

I’m struggling with which nodes link up to what. Am I even close? I haven’t actually seen what this node structure looks like. There is one with a bunch of android conversion calls, but I’m developing for IOS. Any other builds I’ve seen in blueprint screens seem to be related specifically to getting those XYZ outputs in the viewports, which I’ve done.

How do I provide offsets? Which node should I look up?

Thank you.

Here is the answer. Turns out Gage, What I wanted was much simpler than you might have understood it. Here is the blueprint:

So the next task is getting a joystick to raise the camera’s elevation and lower it for mobile.

Did you tested that in Android? Axis Y on Tilt always return 0 on Android for me. Works fine on iOS…

yah on android , Y is always 0 for me too.

Hi!

Has anyone managed to fix Y tilt always being 0?

Me too. One axis on Android doesnt read if the phone is physically in landscape orientation

Me too, Y axis on Android does not work.