Developer Notes

This issue has been closed as 'Won't Fix' due to an extended period of time without updates. If this issue is important to you please let us know by posting on the AnswerHub or UDN, and Epic will re-open the ticket for further review.

Description

Calling DeprojectScreenPositionToWorld while in VR mode does not project from the center of the Oculus view. Using the results of the call with a line trace will show the line coming off center from the right.

Steps to Reproduce

1. Open UE4 Editor (FPS Template)
2. Add code to project based on PlayerController (MyPCClass)
3. in MyPCClass add the following to the .h file:

UFUNCTION(BlueprintCallable, Category="MyController")
void MouseTrace(const FVector2D& mouse, float endOffset, FHitResult& hit);

4. In MyPCClass add the following to the .cpp file:

void AMyController::MouseTrace(const FVector2D & mouse, float endOffset, FHitResult & hit)
 {
     FVector start;
     FVector end;
     FVector direction;
     DeprojectScreenPositionToWorld(mouse.X, mouse.Y, start, direction);
     end = start + (direction * endOffset);
 
     TArray<AActor *> arrayActors;
     UKismetSystemLibrary::LineTraceSingle_NEW(this, start, end, UEngineTypes::ConvertToTraceType(ECollisionChannel::ECC_Visibility), false, arrayActors, EDrawDebugTrace::Type::ForOneFrame, hit, false);
 }

5. Compile
6. Create a BP based on MyPCClass (MyPCBP)
7. Wire MouseTrace function to fire on tick
8. Set game mode to use MyPCBP
9. Run in VR mode

Result:
the line trace will show up coming from the right of the shoulder rather than from the center of the screen.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Won't Fix
ComponentUE - Platform - XR
Affects Versions4.7.64.8
CreatedMay 6, 2015
ResolvedApr 3, 2017
UpdatedSep 16, 2019
View Jira Issue