How can I rotate the camera around the player using the right virtual joystick?
I am attempting to get player control with the left virtual joystick and I would like to be able to spin the camera around the player with the right joystick. This is all being done in the ball rolling example map. How would I go about controlling the camera with the right stick but still constraining it to the same distance from my character and always keeping my character centered within the camera view? Thanks.
asked Dec 31 '15 at 05:04 PM in Blueprint Scripting
Since the PhysicsBallBP Pawn in the Rolling template is already using a SpringArm component to maintain the distance between Ball and Camera, this is a pretty easy thing to implement. You'll notice that the Transform of the SpringArm component is set to AbsoluteRotation. By changing the Z to 90, you'll see it has maintained the distance between the camera and ball components, but rotated to face the ball from another direction.
The easiest way to set this up is by adding another Input to turn the camera (Edit > Project Settings > Input) as follows:
Then, in the Event Graph for the PhysicsBallBP, add the following:
This will take the Axis input from the Right Thumbstick (-1 to 1) and add rotation to the Spring Arm. This occurs on tick, so it's a nice smooth movement, but you can adjust this by multiplying or dividing the Axis Value before plugging it into the Make Rotator Z input.
Hope that helps!
answered Dec 31 '15 at 10:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here