private void button1_Click(object sender, EventArgs e) { Head head = new Head(); Chest chest = new Chest(); Pelvis pelvis = new Pelvis(); LeftUpperArm leftupperarm = new LeftUpperArm(); Console.WriteLine($"Head: {head.GetTotalSurfaceOfArteries()}"); Console.WriteLine($"Chest: {chest.GetTotalSurfaceOfArteries()}"); Console.WriteLine($"Pelvis: {pelvis.GetTotalSurfaceOfArteries()}"); Console.WriteLine($"LefUpperArm: {leftupperarm.GetTotalSurfaceOfArteries()}"); }
// Start is called before the first frame update void Start() { rBody = Pelvis.GetComponent <Rigidbody>(); fltJoint = FLThigh.GetComponent <HingeJoint>(); frtJoint = FRThigh.GetComponent <HingeJoint>(); rrtJoint = RRThigh.GetComponent <HingeJoint>(); rltJoint = RLThigh.GetComponent <HingeJoint>(); frsJoint = FRShin.GetComponent <HingeJoint>(); flsJoint = FLShin.GetComponent <HingeJoint>(); rrsJoint = RRShin.GetComponent <HingeJoint>(); rlsJoint = RLShin.GetComponent <HingeJoint>(); }
/// <summary> /// Initiate the %Grounding as an integrated solver by providing the root Transform, leg solvers, pelvis Transform and spine solver. /// </summary> public void Initiate(Transform root, Transform[] feet) { this.root = root; initiated = false; rootHit = new RaycastHit(); // Constructing Legs if (legs == null) { legs = new Leg[feet.Length]; } if (legs.Length != feet.Length) { legs = new Leg[feet.Length]; } for (int i = 0; i < feet.Length; i++) { if (legs[i] == null) { legs[i] = new Leg(); } } // Constructing pelvis if (pelvis == null) { pelvis = new Pelvis(); } string errorMessage = string.Empty; if (!IsValid(ref errorMessage)) { Warning.Log(errorMessage, root, false); return; } // Initiate solvers only if application is playing if (Application.isPlaying) { for (int i = 0; i < feet.Length; i++) { legs[i].Initiate(this, feet[i]); } pelvis.Initiate(this); initiated = true; } }
protected void BuildCharacter() // NOTE: In indra, this is virtual { //------------------------------------------------------------------------- // remove all references to our existing skeleton // so we can rebuild it //------------------------------------------------------------------------- // FlushAllMotions(); // TODO: Should this be in the Character that this AvatarAppearance is connected to? Or will be... //------------------------------------------------------------------------- // remove all of mRoot's children //------------------------------------------------------------------------- Root.RemoveAllChildren(); JointMap.Clear(); IsBuilt = false; //------------------------------------------------------------------------- // clear mesh data //------------------------------------------------------------------------- foreach (AvatarJoint avatarJoint in MeshLod) { foreach (AvatarJointMesh avatarJointMesh in avatarJoint.MeshParts) { avatarJointMesh.SetMesh(null); } } //------------------------------------------------------------------------- // (re)load our skeleton and meshes //------------------------------------------------------------------------- bool status = LoadAvatar(); // TODO: Indra times this and logs the time it took to load the avatar Logger.LogDebug("AvatarAppearance.BuildCharacter", "Avatar loaded."); if (status == false) { if (IsSelf) { Logger.LogError("AvatarAppearance.BuildCharacter", "Unable to load user's avatar"); } else { Logger.LogWarning("AvatarAppearance.BuildCharacter", "Unable to load other's avatar"); } return; } //------------------------------------------------------------------------- // initialize "well known" joint pointers //------------------------------------------------------------------------- Pelvis = Root.FindJoint("mPelvis"); Torso = Root.FindJoint("mTorso"); Chest = Root.FindJoint("mChest"); Neck = Root.FindJoint("mNeck"); Head = Root.FindJoint("mHead"); Skull = Root.FindJoint("mSkull"); HipLeft = Root.FindJoint("mHipLeft"); HipRight = Root.FindJoint("mHipRight"); KneeLeft = Root.FindJoint("mKneeLeft"); KneeRight = Root.FindJoint("mKneeRight"); AnkleLeft = Root.FindJoint("mAnkleLeft"); AnkleRight = Root.FindJoint("mAnkleRight"); FootLeft = Root.FindJoint("mFootLeft"); FootRight = Root.FindJoint("mFootRight"); WristLeft = Root.FindJoint("mWristLeft"); WristRight = Root.FindJoint("mWristRight"); EyeLeft = Root.FindJoint("mEyeLeft"); EyeRight = Root.FindJoint("mEyeRight"); //------------------------------------------------------------------------- // Make sure "well known" pointers exist //------------------------------------------------------------------------- if (!(Pelvis != null && Torso != null && Chest != null && Neck != null && Head != null && Skull != null && HipLeft != null && HipRight != null && KneeLeft != null && KneeRight != null && AnkleLeft != null && AnkleRight != null && FootLeft != null && FootRight != null && WristLeft != null && WristRight != null && EyeLeft != null && EyeRight != null)) { Logger.LogError("AvatarAppearance.BuildCharacter", "Failed to create avatar."); return; } //------------------------------------------------------------------------- // Initialise the pelvis //------------------------------------------------------------------------- // SL-315 Pelvis.SetPosition(new Vector3(0.0f, 0.0f, 0.0f)); IsBuilt = true; }
public Biped(World w, Vec2 position) { _world = w; BipedDef def = new BipedDef(); BodyDef bd = new BodyDef(); // create body parts bd = def.LFootDef; bd.Position += position; LFoot = w.CreateBody(bd); LFoot.CreateShape(def.LFootPoly); LFoot.SetMassFromShapes(); bd = def.RFootDef; bd.Position += position; RFoot = w.CreateBody(bd); RFoot.CreateShape(def.RFootPoly); RFoot.SetMassFromShapes(); bd = def.LCalfDef; bd.Position += position; LCalf = w.CreateBody(bd); LCalf.CreateShape(def.LCalfPoly); LCalf.SetMassFromShapes(); bd = def.RCalfDef; bd.Position += position; RCalf = w.CreateBody(bd); RCalf.CreateShape(def.RCalfPoly); RCalf.SetMassFromShapes(); bd = def.LThighDef; bd.Position += position; LThigh = w.CreateBody(bd); LThigh.CreateShape(def.LThighPoly); LThigh.SetMassFromShapes(); bd = def.RThighDef; bd.Position += position; RThigh = w.CreateBody(bd); RThigh.CreateShape(def.RThighPoly); RThigh.SetMassFromShapes(); bd = def.PelvisDef0; bd.Position += position; Pelvis = w.CreateBody(bd); Pelvis.CreateShape(def.PelvisPoly); Pelvis.SetMassFromShapes(); bd = def.PelvisDef; bd.Position += position; Stomach = w.CreateBody(bd); Stomach.CreateShape(def.StomachPoly); Stomach.SetMassFromShapes(); bd = def.ChestDef; bd.Position += position; Chest = w.CreateBody(bd); Chest.CreateShape(def.ChestPoly); Chest.SetMassFromShapes(); bd = def.NeckDef; bd.Position += position; Neck = w.CreateBody(bd); Neck.CreateShape(def.NeckPoly); Neck.SetMassFromShapes(); bd = def.HeadDef; bd.Position += position; Head = w.CreateBody(bd); Head.CreateShape(def.HeadCirc); Head.SetMassFromShapes(); bd = def.LUpperArmDef; bd.Position += position; LUpperArm = w.CreateBody(bd); LUpperArm.CreateShape(def.LUpperArmPoly); LUpperArm.SetMassFromShapes(); bd = def.RUpperArmDef; bd.Position += position; RUpperArm = w.CreateBody(bd); RUpperArm.CreateShape(def.RUpperArmPoly); RUpperArm.SetMassFromShapes(); bd = def.LForearmDef; bd.Position += position; LForearm = w.CreateBody(bd); LForearm.CreateShape(def.LForearmPoly); LForearm.SetMassFromShapes(); bd = def.RForearmDef; bd.Position += position; RForearm = w.CreateBody(bd); RForearm.CreateShape(def.RForearmPoly); RForearm.SetMassFromShapes(); bd = def.LHandDef; bd.Position += position; LHand = w.CreateBody(bd); LHand.CreateShape(def.LHandPoly); LHand.SetMassFromShapes(); bd = def.RHandDef; bd.Position += position; RHand = w.CreateBody(bd); RHand.CreateShape(def.RHandPoly); RHand.SetMassFromShapes(); // link body parts def.LAnkleDef.Body1 = LFoot; def.LAnkleDef.Body2 = LCalf; def.RAnkleDef.Body1 = RFoot; def.RAnkleDef.Body2 = RCalf; def.LKneeDef.Body1 = LCalf; def.LKneeDef.Body2 = LThigh; def.RKneeDef.Body1 = RCalf; def.RKneeDef.Body2 = RThigh; def.LHipDef.Body1 = LThigh; def.LHipDef.Body2 = Pelvis; def.RHipDef.Body1 = RThigh; def.RHipDef.Body2 = Pelvis; def.LowerAbsDef.Body1 = Pelvis; def.LowerAbsDef.Body2 = Stomach; def.UpperAbsDef.Body1 = Stomach; def.UpperAbsDef.Body2 = Chest; def.LowerNeckDef.Body1 = Chest; def.LowerNeckDef.Body2 = Neck; def.UpperNeckDef.Body1 = Chest; def.UpperNeckDef.Body2 = Head; def.LShoulderDef.Body1 = Chest; def.LShoulderDef.Body2 = LUpperArm; def.RShoulderDef.Body1 = Chest; def.RShoulderDef.Body2 = RUpperArm; def.LElbowDef.Body1 = LForearm; def.LElbowDef.Body2 = LUpperArm; def.RElbowDef.Body1 = RForearm; def.RElbowDef.Body2 = RUpperArm; def.LWristDef.Body1 = LHand; def.LWristDef.Body2 = LForearm; def.RWristDef.Body1 = RHand; def.RWristDef.Body2 = RForearm; // create joints LAnkle = (RevoluteJoint)w.CreateJoint(def.LAnkleDef); RAnkle = (RevoluteJoint)w.CreateJoint(def.RAnkleDef); LKnee = (RevoluteJoint)w.CreateJoint(def.LKneeDef); RKnee = (RevoluteJoint)w.CreateJoint(def.RKneeDef); LHip = (RevoluteJoint)w.CreateJoint(def.LHipDef); RHip = (RevoluteJoint)w.CreateJoint(def.RHipDef); LowerAbs = (RevoluteJoint)w.CreateJoint(def.LowerAbsDef); UpperAbs = (RevoluteJoint)w.CreateJoint(def.UpperAbsDef); LowerNeck = (RevoluteJoint)w.CreateJoint(def.LowerNeckDef); UpperNeck = (RevoluteJoint)w.CreateJoint(def.UpperNeckDef); LShoulder = (RevoluteJoint)w.CreateJoint(def.LShoulderDef); RShoulder = (RevoluteJoint)w.CreateJoint(def.RShoulderDef); LElbow = (RevoluteJoint)w.CreateJoint(def.LElbowDef); RElbow = (RevoluteJoint)w.CreateJoint(def.RElbowDef); LWrist = (RevoluteJoint)w.CreateJoint(def.LWristDef); RWrist = (RevoluteJoint)w.CreateJoint(def.RWristDef); }
/// <summary> /// Initiate the %Grounding as an integrated solver by providing the root Transform, leg solvers, pelvis Transform and spine solver. /// </summary> public void Initiate(Transform root, Transform[] feet) { this.root = root; initiated = false; rootHit = new RaycastHit(); // Constructing Legs if (legs == null) legs = new Leg[feet.Length]; if (legs.Length != feet.Length) legs = new Leg[feet.Length]; for (int i = 0; i < feet.Length; i++) if (legs[i] == null) legs[i] = new Leg(); // Constructing pelvis if (pelvis == null) pelvis = new Pelvis(); if (!IsValid(true)) return; // Initiate solvers only if application is playing if (Application.isPlaying) { for (int i = 0; i < feet.Length; i++) legs[i].Initiate(this, feet[i]); pelvis.Initiate(this); initiated = true; } }