Beispiel #1
0
    private void FixedUpdate()
    {
        OnFixedUpdate();
        rb.velocity = springManager.GetVelocity(rb.velocity);

        if (springManager.IsDropping())
        {
            var shouldDeploy = CheckForDeploy();
            if (shouldDeploy)
            {
                rb.velocity           = Vector2.zero;
                myParachute           = Instantiate(parachutePrefab, transform.position + Vector3.up, Quaternion.identity);
                joint                 = gameObject.AddComponent <HingeJoint2D>();
                joint.connectedBody   = myParachute.GetComponent <Rigidbody2D>();
                joint.anchor          = new Vector2(0, .59f);
                joint.connectedAnchor = new Vector2(0.05f, -0.6f);
                joint.limits          = new JointAngleLimits2D {
                    max = 359, min = 0
                };
                joint.breakForce  = VeryLarge;
                joint.breakTorque = VeryLarge;
                joint.autoConfigureConnectedAnchor = true;
                springManager.Deploy(rb);
            }
        }

        if (springManager.IsFinished() && joint != null)
        {
            Destroy(joint);
            myParachute.CutLoose();
        }
    }
Beispiel #2
0
    private void FixedUpdate()
    {
        OnFixedUpdate();

        rb.velocity = springManager.GetVelocity(rb.velocity);
    }