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 add Camera to Character?

I created a class deriving from ACharacter

But there's no camera: there's an ArrowComponent, a MovementComponent and a Mesh.

I needed a Camera so I added it through code

 Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
 torchLightComponent = CreateDefaultSubobject<USpotLightComponent>(TEXT("SpotLight_Torch"));

Now I have the Camera with a Spotlight attached to it

alt text

The problem is: I can't look up and down anymore!

The InputComponent is set like this:

    InputComponent->BindAxis("Turn", this, &ATCharacter::AddControllerYawInput);
    InputComponent->BindAxis("LookUp", this, &ATCharacter::AddControllerPitchInput);

I can't understand the problem...

Thanks in advance.

Product Version: UE 4.17
123.jpg (29.7 kB)
more ▼

asked Nov 17 '17 at 02:11 PM in C++ Programming

avatar image

127 38 37 51

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

1 answer: sort voted first

it will be better to create a spring arm component and attach camera to it and set its arm length to 0 if it is for a FP character and also (SpringArm->usePawnControlRotation)

more ▼

answered Nov 19 '17 at 03:50 PM

avatar image

2.4k 73 43 108

avatar image gedamial Nov 19 '17 at 08:19 PM

Really thank you! I asked everywhere and none could be able to give me an answer -.-

But you did, thanks very much!

(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