How can I rotate camera around player using right virtual joystick?

I am attempting to get player control with left virtual joystick and I would like to be able to spin camera around player with right joystick. This is all being done in ball rolling example map. How would I go about controlling camera with right stick but still constraining it to same distance from my character and always keeping my character centered within camera view? Thanks.

Hi Anaklosmos,

Since PhysicsBallBP Pawn in Rolling template is already using a SpringArm component to maintain distance between Ball and Camera, this is a pretty easy thing to implement. You’ll notice that Transform of SpringArm component is set to AbsoluteRotation. By changing Z to 90, you’ll see it has maintained distance between camera and ball components, but rotated to face ball from another direction.

easiest way to set this up is by adding another Input to turn camera (Edit > Project Settings > Input) as follows:

72484-turncamerainput.png

Then, in Event Graph for PhysicsBallBP, add following:

This will take Axis input from Right Thumbstick (-1 to 1) and add rotation to Spring Arm. This occurs on tick, so it’s a nice smooth movement, but you can adjust this by multiplying or dividing Axis Value before plugging it into Make Rotator Z input.

Hope that helps!

This setup works, however, it does not update ball controls to direction in which camera is facing. Ex. When I rotate 90 degrees clockwise, and push up on virtual joystick, expecting ball to roll forward in relation to camera view, it will roll left. Simply put, controls stay consistent when they should be updated based on camera view. How can I fix this so that ball will always roll correct direction in relation to camera and joystick? Thanks

Ah, okay, in that case you also need to rotate vector you’re using for Torque to match Spring Arm’s new rotation. It should look like this:

You’ll want to do same for Roll Forwards/Backwards controls.

Awesome! That worked perfectly! Thanks so much!

what is that node with X that attaches from InputAxis > ??? >> Make VEctor?

It’s a multiplication node. Type in * to access it in blueprints.

Sorry to ask, but using that same layout I cant seem to get my forward/backward controls to work. Is there anything different or is it completely identical to right/left? Right/left works perfectly.

Thanks!

Just do Same to Roll Forwards/Backwards.

I just copied and pasted GetWorldRotation, and Rotate Vector, and connected it up like my picture.
If you cant get it to work, just reply!

I used instead of Spring Arm Camera then it worked. Thanks

This setup is not working in ue4.25 can anyone help me out ?