1
\$\begingroup\$

I am developing a mobile game in ue4. For this project, I need to have a "static" camera so that the player can move within the frame not affecting camera location and rotation. But as this is an endless scroller I also need to have the camera move at a constant pace limiting the player's area of movement. Does anyone know how to do this?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Am I correct to assume you currently have a camera that is follows the player? It's generally a good idea to provide your current situation as clearly as possible. If I understand correctly: you have a camera that follows the player, but you want to have it pointed in a static direction while giving it a fixed speed. Is that correct? If so, please edit your question to reflect that. If not, please edit your question to reflect what you've tried and where you're stuck. \$\endgroup\$ Commented Apr 14, 2019 at 10:14
  • \$\begingroup\$ What specific part of this are you stuck on at the moment? The forward movement of the camera? The bounding of the player's movement? The movement of the bounds with the camera? \$\endgroup\$ Commented Apr 14, 2019 at 12:39
  • \$\begingroup\$ Basically everything because I can't break the link between the camera and the player. \$\endgroup\$ Commented Apr 14, 2019 at 17:37
  • \$\begingroup\$ Basically the camera is within the character blueprint and as a patent it will obviously follow the character and I don't want that. \$\endgroup\$ Commented Apr 14, 2019 at 17:39

2 Answers 2

1
\$\begingroup\$

I could think of two ways on how to solve your problem.

  • Player-centered approach: Update the position of the static camera based on the position of the player pawn

e.g. in pseudocode assuming the player moves into the x direction:

Vector3 cam_to_player_distance = {0, 100.0f, 100.0f};
cam_position = player_pawn.getActorLocation() + cam_to_player_distance;

  • Camera-centered approach: (my choice)

Make the camera the controlled pawn and add the runner as a child actor. Now you can freely move the runner to the left and right and without the camera being affected

\$\endgroup\$
-3
\$\begingroup\$

Greatings, the trick is not moving the player but the level.

\$\endgroup\$
5
  • \$\begingroup\$ That is a trick. You could simply give the camera a fixed (or even variable) speed. \$\endgroup\$ Commented Apr 14, 2019 at 10:10
  • 1
    \$\begingroup\$ One line answers are generally incomplete. How would they achieve this? \$\endgroup\$ Commented Apr 14, 2019 at 11:45
  • \$\begingroup\$ Also, yes, it's a "trick", but the general consensus is still to move the camera. \$\endgroup\$ Commented Apr 14, 2019 at 12:13
  • \$\begingroup\$ It absolutely needs to be moving to my project \$\endgroup\$ Commented Apr 14, 2019 at 13:54
  • \$\begingroup\$ Peethor the problem is how to do this since the camer need's to be parented to the character and it can't be the character's root \$\endgroup\$ Commented Apr 14, 2019 at 14:00

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.