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 Change camera Aspect Ratio with Device orientation (Android)

My camera's aspect ratio doesn't change when my sensor goes from portrait to landscape making the game very distorted. Is there a way to go around this? I was hoping I could add a branch that detected the orientation of the device, but I can't seem to find anything I could add to the blueprint to detect it. Would the simpilest method be to remove restraints on the camera? It doesn't sound too good an idea to me.

An example from another thread of someone doing landscape to portrait: https://forums.unrealengine.com/attachment.php?attachmentid=16452&d=1415337434

Product Version: Not Selected
Tags:
more ▼

asked Mar 28 '15 at 02:09 PM in Blueprint Scripting

avatar image

Fantasmos
16 1 1 2

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

1 answer: sort voted first

I am not sure, if this is what you want, but I found a solution for the problem, that my game looked heavily distorted in portrait orientation. The problem actually is, that the Field of View (FOV) is calculated between the left and right edges of the viewport. So if you have a FOV of 90° and an aspect ratio of 16/9 in Landscape, the horizontal FOV is 90°, but the vertical FOV is 50.625°. In Portrait the horizontal FOV is still 90°, because the FOV is applied horizontally, i.e. between the left and right edges. But the vertical FOV is now 160°, because the vertical length of the viewport is now greater than the horizontal width. So to fix this, I created a custom PlayerCameraManager in C++:

header:

 UCLASS()
 class ROBOTDEFENSECPP_API AMobilePlayerCameraManager : public APlayerCameraManager
 {
     GENERATED_BODY()
     
 protected:
     virtual void UpdateViewTargetInternal(FTViewTarget& OutVT, float DeltaTime) override;
     
     
 };

.cpp

 void AMobilePlayerCameraManager::UpdateViewTargetInternal(FTViewTarget& OutVT, float DeltaTime)
 {
     Super::UpdateViewTargetInternal(OutVT, DeltaTime);
 
     if (GSystemResolution.ResX < GSystemResolution.ResY)
     {
         OutVT.POV.FOV *= GSystemResolution.ResX / GSystemResolution.ResY;
     }
 }
 
more ▼

answered Sep 26 '16 at 04:49 PM

avatar image

AllJonasNeeds
249 26 36 71

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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