Deproject Screen Position To World Function, How does it work?


DeprojectScreenPositionToWorld is used to convert 2D screen position to World Space 3D positionand direction !!

What are the equations, processes or formulas controlling that conversion?

For example:
DeprojectScreenPositionToWorld(CrosshairScreenPosition.X, CrosshairScreenPosition.Y,OutWorldLocation, OutWorldDirection)

  • When Crosshair ScreenPosition equals X=666.000 Y=132.000
  • Then the OutWorldLocation was X=1798.315 Y=8483.038 Z=-5517.866
  • And the OutWorldDirection was X=0.995 Y=0.002 Z=0.097
    So from where did OutWorldLocation and OutWorldDirection get these values?

Another question, OutWorldDirection values, X=0.995, what does that mean? same thing of Y=0.002 and Z=0.097 ? What is the relation of that strange numbers and the direction?


This is kind of the whole point of using an engine, these things are abstracted away so you don’t need to know how they work internally. Just how to use, if you want to see the implementation you can right click and go to definition.

That would be the X component’s value for the direction vector.