public BioSegment Create(BioIK character) { Character = character; Transform = transform; hideFlags = HideFlags.HideInInspector; return(this); }
private void Start() { ik = GetComponent <BioIK.BioIK>(); if (joints == null || targets == null || joints.Length == 0 || targets.Length == 0) { FindJoints(); } }
public Model(BioIK character) { Character = character; //Set Root Root = Character.FindSegment(Character.transform); //Create Root AddNode(Root); //Build Model BioObjective[] objectives = CollectObjectives(Root, new List <BioObjective>()); for (int i = 0; i < objectives.Length; i++) { List <BioSegment> chain = Character.GetChain(Root, objectives[i].Segment); for (int j = 1; j < chain.Count; j++) { AddNode(chain[j]); } } //Assign DoF DoF = MotionPtrs.Length; //Initialise arrays for single transform modifications for (int i = 0; i < Nodes.Length; i++) { Nodes[i].ObjectiveImpacts = new bool[ObjectivePtrs.Length]; } PX = new double[ObjectivePtrs.Length]; PY = new double[ObjectivePtrs.Length]; PZ = new double[ObjectivePtrs.Length]; RX = new double[ObjectivePtrs.Length]; RY = new double[ObjectivePtrs.Length]; RZ = new double[ObjectivePtrs.Length]; RW = new double[ObjectivePtrs.Length]; Configuration = new double[MotionPtrs.Length]; Gradient = new double[MotionPtrs.Length]; Losses = new double[ObjectivePtrs.Length]; SimulatedLosses = new double[ObjectivePtrs.Length]; //Assigns references to all objective nodes that are affected by a parenting node for (int i = 0; i < ObjectivePtrs.Length; i++) { Node node = ObjectivePtrs[i].Node; while (node != null) { node.ObjectiveImpacts[i] = true; node = node.Parent; } } Refresh(); //DebugSetup(); }
void Awake() { EditorApplication.playmodeStateChanged += PlaymodeStateChanged; Target = (BioIK)target; TargetTransform = Target.transform; Target.Refresh(false); DoF = 0; //MakeVisible(TargetTransform); //MakeInvisible(TargetTransform); }
public static BioSegment AddBioSegment(BioIK character, Transform t) { #if UNITY_EDITOR if (Application.isPlaying) { return((t.gameObject.AddComponent(typeof(BioSegment)) as BioSegment).Create(character)); } else { return((Undo.AddComponent(t.gameObject, typeof(BioSegment)) as BioSegment).Create(character)); } #else return((t.gameObject.AddComponent(typeof(BioSegment)) as BioSegment).Create(character)); #endif }
public void LoadModel(int index) { index -= 1; if (Models.Length > index) { if (ModelGO != null) { ModelGO.SetActive(false); } ModelCharacter = Models[index]; ModelGO = ModelCharacter.transform.root.gameObject; ModelGO.SetActive(true); UpdateMotionType(); } }
public BioIKGroup(BioSegment _segment, BioIK.BioIK _body) { hand_segment = _segment; hand_body = _body; enabled = false; }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); bioik = GetComponentInChildren <BioIK.BioIK>(); }