private void Awake() { inputAction = new InputActions(); inputAction.PlayerControls.Move.performed += ctx => movementInput = ctx.ReadValue <Vector2>(); cf = GetComponent <ConfigurableJoint>(); jtd = GetComponent <JointTargetDisabler>(); //inputAction.PlayerControls.Tackle.performed += ctx => tackle = ctx.ReadValue<float>(); //set joint drive values jd = new JointDrive(); jd0 = new JointDrive(); jd.positionSpring = 10000; jd.positionDamper = 200; jd.maximumForce = 10000; jd0.positionDamper = 0; jd0.positionSpring = 0; jd0.maximumForce = 0; jdGrad.positionDamper = 200; jdGrad.positionSpring = 10000; jdGrad.maximumForce = 10000; myCollider = GetComponent <Collider>(); myRigidbody = GetComponent <Rigidbody>(); //disable collisions with controller collider and self foreach (Collider d in gameObject.GetComponentsInChildren <Collider>()) { Physics.IgnoreCollision(myCollider, d); } camera = GameObject.FindGameObjectWithTag("MainCamera"); stateMachine = new StateMachine(); standingUpState = gameObject.AddComponent <StandingUp>(); standingUpState.Initialize(this, stateMachine, "StandingUp"); idleState = gameObject.AddComponent <Idle>(); idleState.Initialize(this, stateMachine, "Idle"); tacklingState = gameObject.AddComponent <Tackling>(); tacklingState.Initialize(this, stateMachine, "Tackling"); recoveringState = gameObject.AddComponent <Recovering>();; recoveringState.Initialize(this, stateMachine, "Recovering"); movingState = gameObject.AddComponent <Moving>();; movingState.Initialize(this, stateMachine, "Moving"); fallenState = gameObject.AddComponent <Fallen>(); fallenState.Initialize(this, stateMachine, "Fallen"); stateMachine.Initialize(idleState); }