Stickman balance

I am making a stickman game that’s based on physics completely, like Dani’s Off The Sticks. I have the balance script, movement and grabbing ready and working, but I want to make the enemy stickman completely lose balance when hit. How do I make that?

Stickman npc balance script:
Code (CSharp):

  • using System.Collections;
  • using System.Collections.Generic;
  • using UnityEngine;
    • public class Balance : MonoBehaviour
  • {
  • public float restingAngle = 0f;
  • public float force = 750f;
    • private Rigidbody2D rb;
    • private void Start()
  • {
  • rb = GetComponent();
  • }
    • private void FixedUpdate()
  • {
  • rb.MoveRotation(Mathf.LerpAngle(rb.rotation, restingAngle, force * Time.deltaTime));
  • }
  • }

Duplicate post, not using code-tags, not a feature request.

Please, I would suggest posting more information on your original post to bump it. The code above seems to have nothing to do with the question and you seem to be just asking for a code dump on how to do what you need.