Unity3d emission Ray Ray

Source: Internet
Author: User

Ray Camera.main.ScreenPointToRay (Vector3 POS) Returns a ray from the camera to the screen to specify a point

Ray Camera.main.ViewportPointToRay (Vector3 POS) Returns a ray Ray from the camera to the viewport (invalid outside the viewport) specify a point

Raycasthit Ray projection collision Information

BOOL Physics.raycast (Vector3 origin, Vector3 direction, float distance, int layermask)

True if Ray casts intersect with any collider, otherwise false.

BOOL Physics.raycast (Ray Ray, Vector3 direction, raycasthit out hit, float distance, int layermask)

A light that can collide with all the collider in the scene and return details of the collision ().

BOOL Physics.raycast (Ray Ray, float distance, int layermask)

True if Ray casts intersect with any collider, otherwise false.

BOOL Physics.raycast (Vector3 origin, Vector3 direction, raycasthit out hit,float distance, int layermask)

True if Ray casts intersect with any collider, otherwise false.

Raycasthit[] Raycastall (Ray Ray, float distance, int layermask)

Casts a ray and returns all collisions, that is, projecting the light and returning a raycasthit[] structure.

if (Input.getmousebutton (0))
{
Ray Ray = Camera.main.ScreenPointToRay (input.mouseposition);
Raycasthit Hitinfo;
if (Physics.raycast (Ray,out hitinfo))
{
Gameobject gameobj = HitInfo.collider.gameObject;
Debug.Log ("Click Object name is" + gameobj.name);
}
}

Unity3d emission Ray Ray

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.