raycasthit2d unity
RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up);
4.17
6
RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up);
Thank you!
6
0
3.5
6
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.
*/
Thank you!
6
0
Are there any code examples left?
New code examples in category C#