2D GRAPPLE GUN QUEST: ‘Connect the Joint' - Solutions

Quest: 2D Grapple Gun Quest
Challenge: Connect the Joint

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

Here’s my solution:

joint.connectedBody = hit.rigidbody;
2 Likes

Any idea why Mr Slinky would be invisible? I tried increasing the sprite renderer order in layer with no luck. Color alpha channel is 255. Using Unity 2020.3.6.

Shows up in scene editor while playing, but not in the game:

2 Likes

Have you got the layers set up correctly?
Slink needs to be on a Player layer and layers can get lost with package imports and exports
And the Camera’s culling mask could be hiding it

2 Likes

Yep, thank you! It was the camera culling mask, didn’t have Player checked.

2 Likes

The issue is also setting the correct anchor. Otherwise the anchor for the joint will be the worldposition of the object. And in order for the physics engine to properly swing at the correct anchor point I had to set the anchor point to the relativ local position of the rigidbody

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

that way if I now lower the distance I can swing. Before that I was just jeeted over the map depending on the players relative position to the center of the object he grappeled on