![]() ![]() public static RaycastHit2D Raycast(Vector2 origin, Vector2 direction, float distance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, float minDepth = -Mathf.Infinity, float maxDepth = Mathf.Infinity) We can see different versions of it, but let’s focus on the first one, we will talk about the others later in the article. I knew you would have noticed, using the Physics 2D library means we have to use it in the FixedUpdate for a good practice. ![]() The method we need to do all the magic is this one Physics2D.Raycast. So what are we waiting for? Let’s create our first laser beam to detect objects in our game! Physics 2D Raycast method We will cover some of these interesting cases together.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |