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"

Trying to code the Camera location/position in code

Hey, I'm new to programming in UE4 and I'm having trouble with how to code the Camera position using C++. I tried two different ways, but it seems not to be doing the trick. My intentions is to move the camera with the PlayerController class; But, I want to set a default location for the camera when the game has started. Everything I seem to do has failed. Here's the header code for it.

CPCameraController.h

 UCLASS()
 class CAMERAPRACTICE_API ACPCameraController : public APlayerController
 {
     GENERATED_UCLASS_BODY()
 
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
     TSubobjectPtr<UCameraComponent> FirstPersonCameraComponent;
 
     
     
 };

and here's the CPP of it

 ACPCameraController::ACPCameraController(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
     // Creating the camera component
     FirstPersonCameraComponent = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("CPFirstCamera"));
     //FirstPersonCameraComponent->RelativeLocation = FVector(50, 0, 112);
     FirstPersonCameraComponent->AddLocalTransform(FTransform(FVector(0, 0, 112)));
 
     
 }
 

I have yet write the code to move, but I wanted to see my problem on here first. I don't know if the reason is because I have the camera in the PlayerController class.

Product Version: Not Selected
Tags:
more ▼

asked Jan 28 '15 at 11:05 PM in C++ Programming

avatar image

Joe Storm
6 1 1

avatar image Jared Therriault Jan 29 '15 at 02:35 AM

In which engine version are you programming? A lot of this stuff is deprecated.

avatar image Joe Storm Jan 29 '15 at 05:25 AM

I'm using 4.5.1 right now. For some reason, 4.6 won't work on my laptop

(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