/* * Draws the scene view helpers for IKSolverFullBody * */ public static void AddScene(UnityEngine.Object target, IKSolverFullBody solver, Color color, bool modifiable, ref int selectedEffector, float size) { if (!modifiable) return; if (!solver.initiated) return; if (!Application.isPlaying && !solver.IsValid()) return; // Effectors for (int i = 0; i < solver.effectors.Length; i++) { bool rotate = solver.effectors[i].isEndEffector; float weight = rotate? Mathf.Max(solver.effectors[i].positionWeight, solver.effectors[i].rotationWeight): solver.effectors[i].positionWeight; if (weight > 0 && selectedEffector != i) { Handles.color = color; if (rotate) { if (Handles.Button(solver.effectors[i].position, solver.effectors[i].rotation, size * 0.5f, size * 0.5f, Handles.DotCap)) { selectedEffector = i; return; } } else { if (Handles.Button(solver.effectors[i].position, solver.effectors[i].rotation, size, size, Handles.SphereCap)) { selectedEffector = i; return; } } } } for (int i = 0; i < solver.effectors.Length; i++) IKEffectorInspector.AddScene(solver.effectors[i], color, modifiable && i == selectedEffector, size); if (GUI.changed) EditorUtility.SetDirty(target); }
/* * Draws the scene view helpers for IKSolverFullBody * */ public static void AddScene(IKSolverFullBody solver, Color color, bool modifiable, ref int selectedEffector, float size) { if (!solver.IsValid(false)) return; if (!Application.isPlaying) return; // Effectors for (int i = 0; i < solver.effectors.Length; i++) { bool rotate = solver.effectors[i].isEndEffector; float weight = rotate? Mathf.Max(solver.effectors[i].positionWeight, solver.effectors[i].rotationWeight): solver.effectors[i].positionWeight; if (weight > 0 && selectedEffector != i) { Handles.color = color; if (rotate) { if (Handles.Button(solver.effectors[i].position, solver.effectors[i].rotation, size * 0.5f, size * 0.5f, Handles.DotCap)) { selectedEffector = i; return; } } else { if (Handles.Button(solver.effectors[i].position, solver.effectors[i].rotation, size, size, Handles.SphereCap)) { selectedEffector = i; return; } } } } for (int i = 0; i < solver.effectors.Length; i++) IKEffectorInspector.AddScene(solver.effectors[i], color, modifiable && i == selectedEffector, size); }
/* * Draws the scene view helpers for IKSolverFullBody * */ public static void AddScene(UnityEngine.Object target, IKSolverFullBody solver, Color color, bool modifiable, ref int selectedEffector, float size) { if (!modifiable) { return; } if (!solver.initiated) { return; } if (!Application.isPlaying && !solver.IsValid()) { return; } // Effectors for (int i = 0; i < solver.effectors.Length; i++) { bool rotate = solver.effectors[i].isEndEffector; float weight = rotate? Mathf.Max(solver.effectors[i].positionWeight, solver.effectors[i].rotationWeight): solver.effectors[i].positionWeight; if (weight > 0 && selectedEffector != i) { Handles.color = color; if (rotate) { if (Handles.Button(solver.effectors[i].position, solver.effectors[i].rotation, size * 0.5f, size * 0.5f, Handles.DotCap)) { selectedEffector = i; return; } } else { if (Handles.Button(solver.effectors[i].position, solver.effectors[i].rotation, size, size, Handles.SphereCap)) { selectedEffector = i; return; } } } } for (int i = 0; i < solver.effectors.Length; i++) { IKEffectorInspector.AddScene(solver.effectors[i], color, modifiable && i == selectedEffector, size); } if (GUI.changed) { EditorUtility.SetDirty(target); } }