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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to make the camera not rotate?

I'm making a top down game and I want the camera to not rotate at all when the player rotates. I know in unity you keep the camera separated and update the camera position in a script and I'm sure you can do that in UE4 as well, thing is this is gonna be a split-screen game and I don't know if UE4 allows split-screen if the camera is not in the blueprint.

I tried this code:

 void AMyCharacter::moveRotate(float Value)
 {
     this->AddControllerYawInput(Value);
     topDownCamera->AddLocalRotation(FRotator(0.0, 0.0, -Value));
 }

to see if I could cancel out the rotation but it still rotated (although it did rotate slower than the parent) I tried setting the relative rotation and the world rotation to zero and it didn't work, I tried setting the camera as the root component and it didn't work either.

I just want the camera to not rotate when my character rotates.

Any help will be appreciated, thanks.

P.S I'm using the A and D keys to rotate my character

Product Version: UE 4.7
Tags:
more ▼

asked Jun 02 '15 at 08:43 AM in C++ Programming

avatar image

ArgenisXD
3 3 7 7

avatar image staticvoidlol Jun 03 '15 at 07:03 AM

I haven't worked with splitscreen, but I assume that the camera would be dependent on both Characters. I suspect you'll require some kind of camera manager which handles the logic of where the camera should be pointing.

In any case, in single player you can do it as follows:

You could override CalcCamera in your Character class to get the behaviour you want, e.g.

 void AYourCharacter::CalcCamera(float DeltaTime, FMinimalViewInfo& OutResult)
 {
     OutResult.Rotation = ...
 }
avatar image ArgenisXD Jun 06 '15 at 05:44 PM

I might have a solution by making a separate camera class and then just activating the camera for the specific players.

avatar image Zhi Kang Shao Jun 06 '15 at 06:04 PM

Try this instead: Place a USpringArmComponent in the hierarchy between the camera component and its parent. Then set bInheritYaw to false.

You can use a spring arm in your component hierarchy to prevent it from inheriting its rotation from its parent.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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