Answers for "raycasthit2d unity"

C#
2

raycasthit unity

RaycastHit hit;
/*
(Vector3) hit.point - the point where the ray has collided.
(Quaternion) hit.normal - the normal of the GameObject the ray has collided.
(float) hit.distance - the distance between the ray origin and hit.point.
(Transform) hit.transform - the transform of the GameObject the ray has hit
(Rigidbody) hit.rigidbody - rigidbody attached to GameObject ray collided,
							if no rigidbody is attached, value is null.
(Vector2) hit.textureCoord - the coordinate of the point on the texture
							 of the GameObject the ray collided.
*/
Posted by: Guest on July-20-2021
1

raycasthit2d unity

RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up);
Posted by: Guest on February-15-2021

C# Answers by Framework

Browse Popular Code Answers by Language