Esempio n. 1
0
        public void OnHold(Holder _holder)
        {
            if (debugLog)
            {
                Debug.Log(gameObject.name + "OnHold " + gameObject.name + " To:" + _holder.name);
            }

            if (isKinematicOption == IsKinematicOption.RigidbodyToHold)
            {
                Utils.ToggleColliders(colliders, false, collidersDontToggle);
                rigidbodyToHold.transform.position = holder.transform.position;
                rigidbodyToHold.transform.rotation = holder.transform.rotation;
            }
            else if (isKinematicOption == IsKinematicOption.All)
            {
                PhysicsRigUtils.ToggleRigKinematic(transform, true);
                Utils.ToggleColliders(colliders, false, collidersDontToggle);
                transform.position = ParentPositionWithHoldPointOffset(holder.transform.position);
                transform.rotation = holder.transform.rotation;
            }
            else if (isKinematicOption == IsKinematicOption.None)
            {
                rigidbodyToHold.isKinematic = true;
                rigidbodyToHold.MovePosition(holder.transform.position);
                rigidbodyToHold.MoveRotation(holder.transform.rotation);
            }
            onHold.Invoke();
        }
 public static void ScaleEnd(Transform parent, ResetableRigidbody[] resetables, bool isKinematicAfter = false)
 {
     PhysicsRigUtils.ResetRigTransform(resetables, false);
     PhysicsRigUtils.FixChildJointsAfterScalingParent(parent);
     PhysicsRigUtils.ResetRigTransform(resetables, false, true);
     PhysicsRigUtils.ToggleRigKinematic(resetables, isKinematicAfter);
 }
 public static void ScaleStart(Transform parent, ResetableRigidbody[] resetables, Transform scalePivot = null)
 {
     PhysicsRigUtils.ToggleRigKinematic(resetables, true);
     if (scalePivot)
     {
         PhysicsRigUtils.MoveParentToCenterOfTransform(parent, scalePivot);
     }
     else
     {
         PhysicsRigUtils.MoveParentToCenterOfChildren(parent);
     }
     PhysicsRigUtils.CacheRig(resetables);
 }
Esempio n. 4
0
        public void OnRelease()
        {
            if (debugLog)
            {
                Debug.Log("OnRelease " + gameObject.name);
            }

            if (isKinematicOption == IsKinematicOption.RigidbodyToHold || isKinematicOption == IsKinematicOption.All)
            {
                PhysicsRigUtils.ToggleRigKinematic(transform, false);
                Utils.ToggleColliders(colliders, true, collidersDontToggle);
            }
            else if (isKinematicOption == IsKinematicOption.None)
            {
                rigidbodyToHold.isKinematic = false;
            }

            onRelease.Invoke();
        }
Esempio n. 5
0
 public void ToggleKinematic(bool toggle)
 {
     PhysicsRigUtils.ToggleRigKinematic(transform, toggle);
 }