x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to create a fixed camera that follows player

Hi, I am creating a third person game which involves two playable character. I am currently having a problem with making the camera fixed but still follow the player. So when the game starts the camera is positioned behind and a little to the right of the player and when the player turns left, right or back the camera is still fixed in the same position. However if I swap to a different character the camera changes its angle depending on what way the character is facing when swapping over. I basically want the camera to stay in the first position of when the game starts. Please help me!

This is the position the camera starts in,

This is the position the camera changes to when I swap characters because of the way the character is facing.

Product Version: UE 4.17
Tags:
more ▼

asked Mar 05 '18 at 12:28 AM in Using UE4

avatar image

EmilyBec
18 4 5 8

avatar image aNorthStar Mar 05 '18 at 01:19 AM

just a thought... if you just need a fixed rotation at all times, you might find it easier and more performance efficient to use one world camera instead of two Character-based camera component.

if I understand what you are looking for, I'd set up a WorldCamera BP (with Spring Arm to give you the offset). Initially (while prototyping) in it's BP on Tick, I'd use Get Actor Location (player) and Set Actor Location (self)

avatar image EmilyBec Mar 05 '18 at 01:24 PM

Thank you for the help, I added a new camera to the world but am struggling with the blueprint event tick, it does not allow me to use get actor location

avatar image aNorthStar Mar 05 '18 at 01:31 PM

... the quick-but-less-efficient-way-that-is good-enough-for-prototyping... use Get Player Pawn and plug it into the actor reference in Get Actor Location

(getting references between actors takes a bit of getting used to... definitely worth spending a couple of hours studying... then you'll know how to do it the efficient way) :)

avatar image EmilyBec Mar 05 '18 at 02:21 PM

I created a camera blueprint and added the camera to the world I have no idea how to add the blueprints together alt text

avatar image aNorthStar Mar 05 '18 at 02:27 PM
  • attach the blue e (actor reference) in Get Player Pawn to the blue circle in Get Actor Location

  • attach the yellow pin (vector) to Set Actor Location...

  • attach white wire Tick to white wire in Set Actor Location

*** yes, it seems utterly incomprehensible at first... with a bit of study you'll get very familiar with it

avatar image EmilyBec Mar 05 '18 at 02:39 PM

I have done that, what do I do next?alt text

avatar image aNorthStar Mar 05 '18 at 02:43 PM
  • remember to attach white wire Tick to white wire in Set Actor Location

also, drag your camera component on top of the spring arm component...

set the spring arm length to your taste...

avatar image EmilyBec Mar 05 '18 at 03:18 PM

Ok I have done that, However the spring arm could only go inside the camera component. So I made a new Actor BP and added a camera so I could put the camera inside the spring arm, would that still work? alt text

avatar image aNorthStar Mar 05 '18 at 03:23 PM

it looks right... the spring arm is now a parent of the camera:

In your custom camera BP, use Begin Play and Set View Target with Blend to set this actor as the active camera

-set the spring arm length -put the camera BP into your level (anywhere is ok, it's BP will set its world location)

avatar image EmilyBec Mar 05 '18 at 03:32 PM

I have begin play but I cannot find set view Target

avatar image aNorthStar Mar 05 '18 at 03:35 PM

draw a white wire from Begin Play... type Set View Target with Blend (untick context sensitive)

avatar image EmilyBec Mar 05 '18 at 03:40 PM

Only these options appear alt text

avatar image aNorthStar Mar 05 '18 at 03:42 PM

yes, do you see the tick box "Context Sensitive" on the right top of the dropdown box? Untick this, and you'll get more choices

avatar image EmilyBec Mar 05 '18 at 03:58 PM

Sorry I did not see that, I have added the view target and put the camera into the world

avatar image aNorthStar Mar 05 '18 at 03:59 PM

Ok, try to press play... see what happens... I bet the rotation will be strange... but it is fixable

avatar image EmilyBec Mar 05 '18 at 04:03 PM

I think I did the blueprint wrong :(alt text

avatar image ThompsonN13 Mar 05 '18 at 04:05 PM

target and new view target need to have a connection to work correctly.

avatar image aNorthStar Mar 05 '18 at 04:07 PM

Almost there... from "Target" pull out a wire and type in Get Player Controller

avatar image EmilyBec Mar 05 '18 at 04:13 PM

Ok done that

avatar image aNorthStar Mar 05 '18 at 04:15 PM

if you are still getting an error... from "New Target" pull out a wire and type Get Reference to Self

avatar image EmilyBec Mar 05 '18 at 04:18 PM

It works! But I am a little too close to the character alt text

avatar image aNorthStar Mar 05 '18 at 04:25 PM

ok, now you are there!

Look at the Spring Arm component settings and adjust them as you like... especially length and lag

You may also need to adjust the Camera BP world rotation...

Ok, I'll let you figure out the rest for yourself... Google is your best friend... good luck! :)

avatar image EmilyBec Mar 05 '18 at 04:26 PM

Thank you for your help! :)

avatar image aNorthStar Mar 05 '18 at 06:16 PM

your welcome! just mark your original question as resolved...

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Resolved! by the above comments

more ▼

answered Mar 05 '18 at 06:53 PM

avatar image

EmilyBec
18 4 5 8

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question