Jump to content

Camera::Project()


StOneDOes
 Share

Go to solution Solved by Josh,

Recommended Posts

Not sure if this is a bug or not, but I wouldn't have thought Camera::Project() to behave this way; Using this function to draw an indicator on the screen based on an item in world position. It works correctly when the item is in the camera's field of view, but it also still returns valid screen coordinates when the item is not in the camera's field of view.

Is this expected?

Link to comment
Share on other sites

  • Solution

Camera::Project transforms a position in 3D space into a 2D coordinate on screen, with a third component for the Z axis.

The coordinate does not necessarily have to be within the camera frustum. It can be outside the field of view, behind the camera, or beyond the camera's far range.

If the z component of the returned value is less than zero (or less than the camera near range, to be more precise) then you can skip 2D drawing. You can also skip drawing if the returned coordinate is far enough outside of the screen rectangle that the object can't be seen.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...