2D GRAPPLE GUN QUEST: ‘Modify our Joint Anchor’ - Solutions

Quest: 2D Grapple Gun Quest
Challenge: Modify our Joint Anchor

Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.

I couldn’t figure out the hint with transform.localScale, but a little googling led me to this solution which seemed to work perfectly

joint.connectedAnchor = hit.transform.InverseTransformPoint(hit.point);

I understand that InverseTransformPoint converts the raycasts world coordinates to the localcoordinates required for the connectedAnchor.


I have to admit, this kind of thing is my weakest area in Unity, from the hint given I thought this would be the solution:

joint.connectedAnchor = new Vector2(hit.transform.localScale.x, hit.transform.localScale.y);

but that doesn’t work. Thanks for @Kosmic for the solution as this one had me stumped.

“A solution”… :stuck_out_tongue_winking_eye:

I went
joint.connectedAnchor = hit.point;
and removed the connectedBody we added earlier

{Something like that anyway (I did it a couple of months ago) and change quite a bit to get a game out of it}

1 Like