Jump to content

How do you draw a ray from camera to center point of the screen?


Recommended Posts

new Ray(origin: Vector3, direction: Vector3, length?: number): Ray

is how you create a ray. Basically I want to draw a ray from camera to the center point of the screen, and cast that ray to see if it hits any mesh. Origin is the position of the camera, but I've got no idea how to calculate direction, since center of the screen is a (x,y) not a (x,y,z)...

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...