Quest: 2D Grapple Gun Quest
Challenge: Yoink
Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.
Quest: 2D Grapple Gun Quest
Challenge: Yoink
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:
private void PullPlayer()
{
//Challenge 2:
joint.distance -= Time.deltaTime * grappleSpeed;
}
I made some few more steps and move the “PullPlayer” method calling to the if statement that checks if the player is holding down the mouse button
private void PullPlayer()
{
joint.distance = Vector2.Distance(playerHand.transform.position, hit.point);
Vector3 dir = (Vector3)hit.point - this.transform.position;
dir.Normalize();
transform.position += dir * joint.distance * grappleSpeed * Time.deltaTime;
}