private void FixedUpdate() { if (!mylife.dead) { if (movement.x != 0 && !myHook.HookActive()) { transform.position += transform.right * movement.x * speed; } if (myHook.HookActive()) { Vector2 anchorPoint = GetComponent <DistanceJoint2D>().connectedBody.transform.position; Vector2 anchorPointDir = anchorPoint - (Vector2)this.transform.position; Vector2 movementDirection = -Vector2.Perpendicular(anchorPointDir); Debug.DrawRay(this.transform.position, movementDirection, Color.red, 0.5f); myRB.velocity += movementDirection * movement.x * forceSpeed * Time.deltaTime; } if (movement.y < 0) { if (!once) { myRB.velocity += new Vector2(0, -Mathf.Abs(myRB.velocity.y) * 2); once = true; } } else if (isGrounded) { once = false; } } }