Make player camera look at object

Terribly sorry for the “low brow” question,

I’ve followed tutorials on how to make a camera that looks at the player but I ideally want to make the player controller look at an object or just a point in the world (like 0,0,0) so you’re essentially locked in orbit, if you move left you’ll orbit left and so forth.

Any help would be greatly appreciated, I’ve been googling and watching all sorts but I’m clearly not a coder, I’m a modeller.

Many thanks.

The easiest way to make the camera orbit a specific world coordinate without using math is to attach a camera to a springarm. You then move it to target location, left/right wound adjust springarm’s rotation and its length is the radius.

1 Like

Thanks for the reply, I’ll look at that and update once I’ve got it sorted, thanks for the pointer.

Okay! Here’s my answer. It works but I’m no coder so this might be sacrilege to some.

First steps are to make sure you have your axis mappings set in the project settings, You’ll need 3, mine are (poorly named) LookUpDown for vertical rotation around the point, ForwardBackward for zooming in and out and Rotate for rotating around the point.

Second you’ll want two Blueprints, a Game Mode type and a Character type, Your Game Mode wants to have the Default Pawn Class set to the Character type blueprint you’ve created.

Your Player Character Blueprint will have the nodes to control it all, You’ll want to +Add Component a Spring Arm and attach a Camera to it.

Input Axis Rotate plugs into the Add Controller Yaw Input, so your pawn will spin in place.

The Input Axis LookUpDown takes the Spring Arm Variable, gets its World Rotation, breaks it into the X Y Z Floats, the X and Z plug back into a Make Rotator while the Axis Value from the LookUpDown Input adds to the current Y Float and plugs back in to the Make Rotator Y Float, you then Set World Rotation targeting the Spring Arm Variable inputting the New Rotation.

Lastly the Input Axis ForwardBack has an Absolute Float Value set to 10 to multiply the Axis Value (to speed it up) this then adds to the Spring Arm Variables Target Arm Length that then Sets the Target Arm Length.

Hopefully this makes sense to people who need it. Pleas let me know if I’ve missed anything or done things in bad practice.

Many thanks.