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"

Set Main Camera View

Hi guys, I put a static Camera in the Scene. What I want is the main view to be the view of this camera. I don't want the camera to follow my player or have any target. I want just a camera that sees the scene from a static place. How can I do that? Right know when I press the Play button the main view is the view of the Player Starter, I want to change that.

Product Version: Not Selected
Tags:
more ▼

asked Jun 29 '14 at 09:53 AM in C++ Programming

avatar image

dbrizov
324 21 22 42

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

1 answer: sort voted first
more ▼

answered Jun 30 '14 at 12:09 PM

avatar image

Shadowriver
34.6k 917 164 1095

avatar image dbrizov Jun 30 '14 at 01:13 PM

Thanks mate, I will try this out when I get home, and will tell you what happened :)

avatar image Shadowriver Jun 30 '14 at 01:19 PM

Also to add, this function set camera to camera component in actor, you can input any actor and it will use camera component of that actor, similar as in spectator mode you can switch between players cameras in some games ;)

avatar image dbrizov Jun 30 '14 at 05:19 PM

Mate, I don't get it. I have to inherit APlayerController and to call the SetViewTarget function to target the static camera?

avatar image Shadowriver Jun 30 '14 at 08:13 PM

You need to call it in player controller. You dont know how to get yor player controller?

avatar image Telimaktar Jun 30 '14 at 06:26 PM

Either PlayerCameraManager->SetViewTarget(ACharacter); // in APlayerConller or through blueprint with Set View Target with Blend

avatar image Shadowriver Jun 30 '14 at 08:11 PM

Set View Target with Blend is diffrent funtion and SetViewTarget is in PlayerController too

avatar image dbrizov Jul 01 '14 at 04:33 PM

Ok, I managed to do it both with C++ code and with a blueprint.

Here is how it's done with C++

 // Header
 UCLASS()
 class ACameraController : public AActor
 {
     GENERATED_UCLASS_BODY()
 
 public:
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "View Target")
     ACameraActor* ViewTarget;
 
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Player Controller")
     APlayerController* PlayerController;
 
     virtual void BeginPlay() override;
 };
 
 // Source
 ACameraController::ACameraController(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
 }
 
 void ACameraController::BeginPlay()
 {
     Super::BeginPlay();
 
     this->PlayerController = this->GetWorld()->GetFirstPlayerController();
     if (this->PlayerController && this->ViewTarget)
     {
         this->PlayerController->SetViewTarget(this->ViewTarget);
     }
 }

This answer shows how it's done with a blueprint

(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