/* * Draws the scene view helpers for IKSolverFABRIKRoot * */ public static void AddScene(IKSolverFABRIKRoot solver, Color color, bool modifiable, ref FABRIKChain selected) { // Protect from null reference errors if (!solver.IsValid(false)) return; Handles.color = color; // Selecting solvers if (Application.isPlaying) { foreach (FABRIKChain chain in solver.chains) SelectChain(chain, ref selected, color); } foreach (FABRIKChain chain in solver.chains) AddSceneChain(chain, color, selected); // Root pin Handles.color = new Color(Mathf.Lerp(1f, color.r, solver.rootPin), Mathf.Lerp(1f, color.g, solver.rootPin), Mathf.Lerp(1f, color.b, solver.rootPin), Mathf.Lerp(0.5f, 1f, solver.rootPin)); if (solver.GetRoot() != null) { Handles.DrawLine(solver.chains[0].ik.solver.bones[0].transform.position, solver.GetRoot().position); Handles.CubeCap(0, solver.GetRoot().position, Quaternion.identity, buttonSize * sizeMlp); } }
/* * Draws the scene view helpers for IKSolverFABRIKRoot * */ public static void AddScene(IKSolverFABRIKRoot solver, Color color, bool modifiable, ref FABRIKChain selected) { // Protect from null reference errors if (Application.isPlaying && !solver.initiated) return; if (!Application.isPlaying) { string message = string.Empty; if (!solver.IsValid(ref message)) return; } Handles.color = color; // Selecting solvers if (Application.isPlaying) { SelectChain(solver.chains, ref selected, color); } AddSceneChain(solver.chains, color, selected); // Root pin Handles.color = new Color(Mathf.Lerp(1f, color.r, solver.rootPin), Mathf.Lerp(1f, color.g, solver.rootPin), Mathf.Lerp(1f, color.b, solver.rootPin), Mathf.Lerp(0.5f, 1f, solver.rootPin)); if (solver.GetRoot() != null) { Handles.DrawLine(solver.chains[0].ik.solver.bones[0].transform.position, solver.GetRoot().position); Handles.CubeCap(0, solver.GetRoot().position, Quaternion.identity, GetHandleSize(solver.GetRoot().position)); } }
public override void Execute() { var ik = EntityView.GetComponent<FABRIKRoot>(); Solver = ik.solver; }