The controls and stuff remind me of a game called give up robot. Is it based on that? Either way it's a pretty good game!
Viewing post in [akj9] all strings attached comments
I imagine you're asking about the rope-mechanic?
It's actually fairly simple, the hook has a statemachine which tells when to pull the player and the pullcode is super basic:
case State.Hooked:
if (connectedBody)
{
var targetVelocity = (rb2D.position - (Vector2)aimPoint.position);
if (targetVelocity.sqrMagnitude > 1f) targetVelocity = targetVelocity.normalized;
connectedBody.velocity = targetVelocity * pull;
}
//pulling player
break;
_______________
connectedBody is the rigidbody of the player character, rb2D is the rigidbody of the hook and aimPoint is the transform from which the hook got shot.
The players velocity is getting set directly, because just adding force is super wonky in Unitys 2D physics.