Plane.Raycast questions.

Hello. I want to create a swinging mechanic like this, where hook shoots out from the player at a 45 degree angle and the character can swing on it (my game idea is also 2D). Anyways, after asking around, I was told that a way I could accomplish this was to use Plane.Raycast from the player character, check to see if the ray hits an object that the player is able to hook onto, and have my hinge joint put there, how would I do this? specifically, how would I use the raycast to check the object it may be hitting and then, move my hinge to that point?


I would suggest to use Physics.Raycast instead of the (limited) Plane.Raycast, because you can get all necessary information from RaycastHit.

Especially for placing the joint you get RaycastHit.point and RaycastHit.normal.