raycasthit2d
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
raycasthit2d [2021/05/05 06:57] – created andrew900460 | raycasthit2d [2021/05/05 07:11] – added syntax coloring for examples andrew900460 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== RaycastHit2D ====== | ||
+ | |||
+ | ==== Implicit Bool Casting Magic ==== | ||
+ | |||
'' | '' | ||
+ | This is because C# has the ability to do implied type conversions, | ||
Example: | Example: | ||
- | < | + | < |
RaycastHit2D hit = Physics2D.Raycast(someStartPoint, | RaycastHit2D hit = Physics2D.Raycast(someStartPoint, | ||
Line 8: | Line 13: | ||
Debug.Log(" | Debug.Log(" | ||
} | } | ||
+ | </ | ||
+ | |||
+ | This is also valid: | ||
+ | <code c#> | ||
+ | RaycastHit2D hit = Physics2D.Raycast(someStartPoint, | ||
+ | |||
+ | bool rayHitSomthing = hit; | ||
</ | </ |
raycasthit2d.txt · Last modified: 2025/01/15 04:35 by 127.0.0.1