Beispiel #1
0
    private void ReconnectLimb(LimbCache limbToConnect)
    {
        // don't connect multiple times
        if (limbToConnect.Limb.GetComponent<CharacterJoint>() != null)
            return;

        // position arm before joint is created to ensure connection.
        limbToConnect.Limb.transform.localPosition = limbToConnect.Position;
        limbToConnect.Limb.transform.localRotation = limbToConnect.Rotation;

        var joint = limbToConnect.Limb.AddComponent<CharacterJoint>();
        joint.connectedBody = limbToConnect.Connectedbody;
        joint.breakForce = limbToConnect.BreakForce;
    }
Beispiel #2
0
    void Awake()
    {
        //Debug.Log(LimbJoints.name);

        LimbCache currentLimb = new LimbCache();
        foreach (var limbJoint in LimbJoints)
        {
            currentLimb = new LimbCache();
            currentLimb.Connectedbody = limbJoint.connectedBody;
            currentLimb.BreakForce = limbJoint.breakForce;
            currentLimb.Limb = limbJoint.gameObject;
            currentLimb.Position = currentLimb.Limb.transform.localPosition;
            currentLimb.Rotation = currentLimb.Limb.transform.localRotation;
            startValues.Add(currentLimb);
        }
    }