private void FixedUpdate()
 {
     XRUI_Helper.ConstraintVelocityLocally(transform, buttonRigidBody, true, true, false);
     XRUI_Helper.ConstraintPositionLocally(transform, buttonRigidBody, true, true, false);
     buttonRigidBody.transform.localRotation = Quaternion.identity;
     buttonObject.localPosition = new Vector3(0, 0, buttonObject.localPosition.z);
 }
Example #2
0
    private void ScaleContent()
    {
        Vector3 interactablePos = currentInteractable.interactable.transform.position;
        Vector3 pivot           = 2 * originalState.position - currentInteractable.originalState.position;

        float initialDistance = Vector3.Distance(pivot, currentInteractable.originalState.position);
        float distance        = Vector3.Distance(pivot, interactablePos);

        float t = distance / initialDistance;

        //Limitate scale
        if ((originalState.scale.x * t) <= minMaxScale.y && (originalState.scale.x * t) >= minMaxScale.x)
        {
            XRUI_Helper.ScaleAround(transform, pivot, originalState.scale * t);
        }
    }
Example #3
0
 private void FixedUpdate()
 {
     XRUI_Helper.ConstraintVelocityLocally(transform, interactableRigidbody, false, true, true);
     transform.localPosition = new Vector3(transform.localPosition.x, 0, 0);
 }