private static bool checkRigidHandsAndDrawGUI() { var rigidHandObjects = (GameObject[])null; var rigidHandsOK = checkRigidHands(out rigidHandObjects); if (!rigidHandsOK) { EditorGUILayout.Space(); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.HelpBox( "Rigid Hands AND an Interaction Manager are present in your scene. " + "Rigid Hands are not compatible with the Interaction Engine and should " + "never be used in tandem with it. You should remove them " + "from your scene.", MessageType.Warning); if (GUILayout.Button(new GUIContent("Select Rigid Hands", "Select RigidHand objects in the current scene."), GUILayout.ExpandHeight(true), GUILayout.MaxHeight(40F))) { Selection.objects = rigidHandObjects; } if (GUILayout.Button("Ignore")) { LeapProjectChecks.SetIgnoredKey(IGNORE_RIGID_HANDS_CHECK_KEY, ignore: true); } } } return(rigidHandsOK); }
private static bool checkTimeStepAndDrawGUI() { var timeStepOK = checkTimeStep(); if (!timeStepOK) { float roundedTimestep = (float)Math.Round(MAX_TIMESTEP, 4); EditorGUILayout.Space(); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.HelpBox( "Your fixed timestep is " + Time.fixedDeltaTime + ", which is slower than the recommended value " + "of " + roundedTimestep + ".\n\nGo to Edit/Project Settings/Time " + "to change the fixed timestep.", MessageType.Warning); if (GUILayout.Button("Auto-fix")) { Time.fixedDeltaTime = roundedTimestep; } if (GUILayout.Button("Ignore")) { LeapProjectChecks.SetIgnoredKey(IGNORE_TIMESTEP_CHECK_KEY, ignore: true); } } } return(timeStepOK); }
private static bool checkGravityAndDrawGUI() { var gravityOK = checkGravity(); if (!gravityOK) { EditorGUILayout.Space(); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.HelpBox("Your gravity magnitude is " + Physics.gravity.y + " which is stronger than the recommended value " + "of -4.905!\n\nGo to Edit/Project Settings/Physics " + "to change the magnitude.", MessageType.Warning); if (GUILayout.Button("Auto-fix")) { Physics.gravity = Vector3.down * MAX_GRAVITY_MAGNITUDE; } if (GUILayout.Button("Ignore")) { LeapProjectChecks.SetIgnoredKey(IGNORE_GRAVITY_CHECK_KEY, ignore: true); } } } return(gravityOK); }
private static bool checkTimeStep() { if (LeapProjectChecks.CheckIgnoredKey(IGNORE_TIMESTEP_CHECK_KEY)) { return(true); } if (Time.fixedDeltaTime > MAX_TIMESTEP + Mathf.Epsilon) { return(false); } else { return(true); } }
private static bool checkGravity() { if (LeapProjectChecks.CheckIgnoredKey(IGNORE_GRAVITY_CHECK_KEY)) { return(true); } if (Mathf.Abs(Physics.gravity.y) > MAX_GRAVITY_MAGNITUDE) { return(false); } else { return(true); } }
private static bool checkRigidHands(out GameObject[] rigidHandObjects) { if (LeapProjectChecks.CheckIgnoredKey(IGNORE_RIGID_HANDS_CHECK_KEY)) { rigidHandObjects = null; return(true); } rigidHandObjects = UnityObject.FindObjectsOfType <RigidHand>().Query() .Select(x => x.gameObject).ToArray(); if (rigidHandObjects.Length != 0 && UnityObject.FindObjectOfType <InteractionManager>() != null) { return(false); } else { return(true); } }