Esempio n. 1
0
        public void PickupObject(CyanEmuPickupHelper pickup)
        {
            if (currentPickup_ != null)
            {
                currentPickup_.Drop();
            }
            currentPickup_ = pickup;

            pickup.UpdatePosition(rightArmPosition_.transform, true);
            FixedJoint fixedJoint = rightArmPosition_.AddComponent <FixedJoint>();

            fixedJoint.connectedBody = pickup.GetRigidbody();
        }
Esempio n. 2
0
        public void DropObject(CyanEmuPickupHelper pickup)
        {
            if (currentPickup_ == pickup)
            {
                currentPickup_ = null;
                FixedJoint fixedJoint = rightArmPosition_.GetComponent <FixedJoint>();
                if (fixedJoint)
                {
                    Destroy(fixedJoint);
                }

                Rigidbody rigidbody = pickup.GetRigidbody();
                rigidbody.velocity        = (rightArmPosition_.transform.position - prevousHandPosition_) * (0.5f / Time.deltaTime);
                rigidbody.angularVelocity = (rightArmPosition_.transform.rotation.eulerAngles - prevousHandRotation_);
            }
        }