How do I Implement Linecast2d
I know HOW linecast is suppose to work but I just can't figure out how to properly implement it in my code.
Basically what I have is a player that can dig through dirt atm. I've got it working so when the user presses S. it digs down and destroys the object. What I am trying to do is do a Linecast from the player and have the line cast start at the player and end a short distance later (say about .5f away) and when that happens, the player digs through the dirt on the side.
I've got a couple layers of dirt all with their own box colliders all with the same tag "Dirt".
Where I run into trouble is trying to work out the arguments. I've got a Vector2 named playerPos which gets the players location (the beginning argument for Physics2d.Linecast). I've also got a Vector2 for blockPos but I don't know how to initialise that without issues from dirt object below the player.
Are there any full start to finish new project -> loading sprites -> coding -> full play tutorials I can go through, I've looked at YouTube videos and stuff but they only seem to show the initialisation of Linecast and not the process before it.
I am really lost at this point with Linecast and would really appreciate something to set me back on track