public void Restart(Transform startPosition) { transform.position = startPosition.position; transform.rotation = startPosition.rotation; // Put on the freaking skateboard if (ConnectToSkateboard) { transform.SetParent(Skateboard.transform); transform.localPosition = new Vector3(-0.16f, 0.23f, 0f); transform.localRotation = Quaternion.Euler(0f, 90f, 0f); transform.SetParent(null); } foreach (var body in _rigidbodies) { body.ClearForces(); } foreach (var child in _ragdollTransforms) { _states[child.GetInstanceID()].RestoreLocal(child); } State = SkaterState.OnBoard; if (_boardJoints != null) { foreach (var joint in _boardJoints) { if (joint == null) { continue; } Destroy(joint); } } if (ConnectToSkateboard) { _boardJoints = new[] { RagdollAnimator.Ragdoll.FindDeep("foot_left").gameObject.gameObject.AddComponent <FixedJoint>(), RagdollAnimator.Ragdoll.FindDeep("foot_right").gameObject.gameObject.AddComponent <FixedJoint>() }; foreach (var joint in _boardJoints) { joint.connectedBody = Skateboard.GetComponent <Rigidbody>(); joint.breakTorque = FeetStickyBreakForce; } } CamController.Target = Skateboard.GetComponent <Rigidbody>(); CamController.transform.position = startPosition.position + (Vector3.up * 5f) + (Vector3.back * 5f); }