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 do I set absolute position input to character position, or main camera position?


I have a need to define the position of the main character through an absolute value set of widgets in the UI. How do I connect the absolute values for position (X, Y and Z) to drive the position of the main character in world space?

I've been researching the API and found multiple methods by which it would be possible to do this, but neither of the dev paths seem straight forward. So, what I've found so far is:

  • Instancing the PlayerCameraManager class

  • Creating a new "Code First Person (C++)" project

    Instancing PlayerCameraManager


  • I have control over very specific camera values: FOV, Location, Rotation, Aspect Ratio, Post Process Setting

  • Ability to add further functionality to the camera seems best here

  • It seems setting the "Location" and "Rotation" values allow for setting absolute values


  • Can't see how to connect an input to any of the attributes here

  • Complex structure: It seems that PlayerCameraManager contains: struct FCameraCacheEntry CameraCache ( which contains: float TimeStamp, and FMinimalViewInfo POV), and APlayerController* PCOwner

  • Unsure if controlling the Location attribute here

    "Code First Person (C++)" Project


  • Much easier access to controlling the player and therefore the camera via: UInputComponent->BindAction() or UInputComponent->BindAxis()

       void FirstPersonCPPProject::SetupPlayerInputComponent(class UInputComponent* inComp)
                 // set up gameplay key bindings
                 inComp->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
                 inComp->BindAction("Fire", IE_Pressed, this, &FirstPersonCPPProject::OnFire);
                 inComp->BindTouch(EInputEvent::IE_Pressed, this, &FirstPersonCPPProject::TouchStarted);
                 inComp->BindAxis("MoveForward", this, &FirstPersonCPPProject::MoveForward);
                 inComp->BindAxis("MoveRight", this, &FirstPersonCPPProject::MoveRight);
                 // We have 2 versions of the rotation bindings to handle different kinds of devices differently
                 // "turn" handles devices that provide an absolute delta, such as a mouse.
                 // "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick
                 inComp->BindAxis("Turn", this, &APawn::AddControllerYawInput);
                 inComp->BindAxis("TurnRate", this, &FirstPersonCPPProject::TurnAtRate);
                 inComp->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
                 inComp->BindAxis("LookUpRate", this, &FirstPersonCPPProject::LookUpAtRate);
  • Less complex entry point to begin making immediate changes


  • Less control over camera parameters

  • No clear control for setting absolute camera position values. I think I would have to connect to an instance of "APawn" in order to set a new player controller (the tool that would take the GUI values and connect through the APawn to inComp->BindAxis (or inComp->BindAction). How this connection would happen though I have no clear idea yet. Furthermore, it seems that these controls, like APawn::AddMovementInput(), work in the method of moving on the current axis as defined by the view direction... so that converting absolute values to strength of movement on predefined axis would be difficult.

    So... Any thoughts?

Product Version: Not Selected
more ▼

asked Apr 18 '14 at 10:09 PM in C++ Programming

avatar image

11 2 5 6

avatar image Pipeliner Apr 22 '14 at 01:41 AM

So,I'm looking at this function `ACharacter::UpdateSimulatedPosition`. I'll look into this function and report back it's ability to set absolute positions for the player in the game.

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

1 answer: sort voted first

I found the answer...

 AActor::SetActorLocation(FVector someVal)

This function on the player will allow for absolute positioning of the character.

more ▼

answered Apr 25 '14 at 11:22 PM

avatar image

11 2 5 6

(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