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"

How to get camera position in Simulate Mode?

Hi! I am currently writing debug functionality with the help of the UDebugDrawService so I can see on-screen text output during simulate mode. Since I want to display the distance between actors and the spectator pawn, I need the camera position. I tried several things:

1.

 APlayerController* Controller = World->GetFirstPlayerController();
 FVector CamLocation = Controller->PlayerCameraManager->GetCameraLocation();
 //FVector CamLocation = Controller->GetFocalLocation();

2.

 APlayerController* Controller = World->GetFirstPlayerController();
 FVector ViewLocation;
 FRotator ViewRotation;
 Controller->GetPlayerViewPoint(ViewLocation, ViewRotation);

The location vector is always 0,0,0. Then I tried to get the SpectatorPawn that was spawned when starting simulate mode. But when I retrieve its location via GetActorLocation() it is also 0,0,0. Anyone got this working?

Product Version: Not Selected
Tags:
more ▼

asked Aug 14 '14 at 02:49 PM in C++ Programming

avatar image

HCK
50 3 6 8

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

1 answer: sort voted first

Hello, HCK!

I believe that the viewport in simulate mode is not controlled by any game object, which means you can't query it for location data. The SpectatorPawn doesn't move when the viewport does (which is why you're getting 0,0,0 for its location). There is a CameraActor that exists during simulate mode, but its location isn't related to the position of the viewport - that's why its location keeps returning as 0,0,0.

Regards,

Jonathan

more ▼

answered Aug 14 '14 at 08:05 PM

avatar image HCK Aug 15 '14 at 06:51 AM

Thank you for the quick reply. OK, that makes sense. The camera location data has to be there somewhere, though. But it's not that crucial, I was just wondering if there is some easy way or if I came across a bug.

(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