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"

Ideas for setting up a "true" First-Person-Camera?

Hello,

I am relatively new to UE4 and my current goal is to create a "player-character" C++-class that inherits from ACharacter.
I would like the camera to be attached to the characters skeletal mesh respectively a fitting socket (e.g. an eye socket). Unfortunately all the attachment-setup functions that I could find inside USceneComponent.h required "USceneComponent"-pointers as arguments.
Any clues what I'm overlooking?

Thanks in advance

Product Version: UE 4.17
Tags:
more ▼

asked Oct 17 '17 at 01:50 PM in C++ Programming

avatar image

TheBeautifulOrc
10 3 6 9

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

1 answer: sort voted first

Why not just attach it to the Mesh of the character and then set it to the socket name? No idea whether this would actually work but I don't see why not as RootComponent is actually allowed so Mesh should be as well as long as you define the mesh within C++.

Another way you could do it is just set it to a camera boom in the position of the characters eyes and simulate blinking etc.

Just wanted to point out that if you even get it into the players eye socket you will have the issue of the players mesh glitching into the camera all the time meaning you will have to create custom animations that make sure that the players head does not come too far forward.

If I am thinking of what you want to do it would be like ARMA style, in the fact that both the third and first person animations are 1:1. The way I would do it is simply create a mesh for 1st person that has his head removed and can only be seen by the owner and for the other players use the actual players mesh that has a head that is invisible to the owner. Setup the same animations maybe use a Rig for the 1st person to get a 1:1 animation setup. Use the same animation blueprint just tweaked slightly for the 1st person mesh. Also disable the dynamic shadows on the 1st person mesh so that only the third person ones are shown. After this you can simulate blinking or whatever you would like just by using camera effects.

more ▼

answered Oct 18 '17 at 01:21 AM

avatar image

XanzUT
6 1 5

avatar image TheBeautifulOrc Oct 18 '17 at 08:05 PM

Thanks for the quick answer. It seems there are some things I should explain.

Why not just attach it to the Mesh of the character and then set it to the socket name? No idea whether this would actually work but I don't see why not as RootComponent is actually allowed so Mesh should be as well as long as you define the mesh within C++.

RootComponent is allowed, because it inherits from USceneComponent. USkeletalMeshComponent does not. So allthough my mesh has been defined (as I stated, my class inherits from ACharacter), it is not possible to use it with the "USceneComponent::SetupAttachment"-function, as this function requires USceneComponent-pointers as arguments.
This was my initial question. Are there any alternative functions I can use?

avatar image TheBeautifulOrc Oct 18 '17 at 08:06 PM

Another way you could do it is just set it to a camera boom in the position of the characters eyes and simulate blinking etc.

At this very early state I haven't even thought about details like blinking. The reason why I want the cameras location and rotation to be bound to the characters head is, because I want the perspective to feel "organic" during all kinds of crazy movement. If I don't bind my camera to my mesh I would have to setup a separate "camera-animation" to simulate the head movement for each and every single character-animation. That would not just mean a ton of work but also be rather impossible, once I start using physical animations (which I'd like to).

avatar image TheBeautifulOrc Oct 18 '17 at 08:07 PM

If I am thinking of what you want to do it would be like ARMA style, in the fact that both the third and first person animations are 1:1.

I would rather not use a "third-person-mesh" and a "first-person-mesh" that just simulates the movement of the characters limbs. This system works (somewhat) in ARMA because all the chatacter needs to do there is moving around and shooting guns. As soon as you want to create an application, where your character can interact with or be affectet by the environment in a physical way (what I'd like my character to) this method does'nt seem to be the most practical or logical approach.

I hope this mess is somewhat comprehensible :D
(Did not fit into one comment)

(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