public static void ParseHumanBodyUpdates(byte[] rawData, int startIndex, ref ConcurrentDictionary <ulong, HumanBody> receivedBodies) { var addedCount = ParserHelper.ToInt(rawData, ref startIndex); for (var i = 0; i < addedCount; i++) { var b = ParseBody(rawData, ref startIndex); receivedBodies.AddOrUpdate(b.ID1, id => b, (id, existingBody) => b); } var removedCount = ParserHelper.ToInt(rawData, ref startIndex); for (var i = 0; i < removedCount; i++) { var b = ParseBody(rawData, ref startIndex); var bodyRemovedFromDictionary = new HumanBody(); receivedBodies.TryRemove(b.ID1, out bodyRemovedFromDictionary); } var updatedCount = ParserHelper.ToInt(rawData, ref startIndex); for (var i = 0; i < updatedCount; i++) { var b = ParseBody(rawData, ref startIndex); receivedBodies.AddOrUpdate(b.ID1, id => b, (id, existingBody) => b); } }
// Use this for initialization void Start() { GameObject templateBody = GameObject.Find("template"); if (templateBody != null) { SkinnedMeshRenderer skinMesh = templateBody.GetComponentInChildren <SkinnedMeshRenderer> (); if (skinMesh != null) { tmpBody = new HumanBody(skinMesh.sharedMesh, skinMesh.bones, templateBody.transform); } } GameObject templateBodyLen = GameObject.Find("templateLen"); if (templateBodyLen != null) { SkinnedMeshRenderer skinMesh = templateBodyLen.GetComponentInChildren <SkinnedMeshRenderer> (); if (skinMesh != null) { tmpBodyLen = new HumanBody(skinMesh.sharedMesh, skinMesh.bones, templateBodyLen.transform); } } SkinnedMeshRenderer render = GetComponent <SkinnedMeshRenderer> (); //body = new HumanBody (render.sharedMesh, render.bones); //sizeTool = new SizeAvatar (body.getMesh (), tmpBody, tmpBodyLen); Mesh mesh = render.sharedMesh; ArrayList calfList = body.vertexIndexsPerBone [HumanBone.R_Thigh]; localCoords = body.getLocalCoordinate(regionNumber); objsPosition = new Vector3[calfList.Count]; for (int i = 0; i < calfList.Count; i++) { objsPosition [i].x = mesh.vertices [(int)calfList [i]].x; objsPosition [i].y = mesh.vertices [(int)calfList [i]].y; objsPosition [i].z = mesh.vertices [(int)calfList [i]].z; GameObject o = (GameObject)Instantiate(obj); o.name = calfList [i].ToString(); o.transform.position = objsPosition [i]; o.transform.parent = gameObject.transform; o.transform.localScale = gameObject.transform.parent.localScale; } bezierCPS = new Vector3[4]; bezier = new Bezier(bezierCPS); for (int i = 0; i < 4; ++i) { GameObject o = (GameObject)Instantiate(obj); o.name = "bezier" + i.ToString(); // o.transform.parent = gameObject.transform; //o.transform.localPosition = ControlPoints.wasitBezierControlPoints [i]; } lineRender = GetComponent <LineRenderer> (); lineRender.SetVertexCount(51); globalScale = 176.0f; globalScale2 = 97.0f; globalScale3 = 35.0f; }
public void AlertHumans() { foreach (Actor actor in activeActors) { HumanBody body = actor.body as HumanBody; if (body != null) { body.agent.Transition(HumanAI.States.Pursuit); } } }
public void HumanBody() { //Arrange HumanBody joe = new HumanBody(0); //Act joe.Traps.Strength = testStrength; //Assert Assert.AreEqual(joe.GetPhysicalScore(), testStrength / 11); }
public IHttpActionResult PostHumanBody(HumanBody humanBody) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.HumanBody.Add(humanBody); _context.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = humanBody.HumanBodyId }, humanBody)); }
public static Actor HumanActor(Vector3 position) { Actor actor = new Actor(); PackedScene packedBodyScene = (PackedScene)ResourceLoader.Load(HumanScene); HumanBody body = packedBodyScene.Instance() as HumanBody; body.AssignActor(actor, ActorHeadPath, ActorTorsoPath); body.movementSpeed = BaseHumanSpeed; body.Translation = position; actor.body = body; return(actor); }
public IHttpActionResult DeleteHumanBody(int id) { HumanBody humanBody = _context.HumanBody.SingleOrDefault(h => h.HumanBodyId == id); if (humanBody == null) { return(NotFound()); } _context.HumanBody.Remove(humanBody); _context.SaveChanges(); return(Ok(humanBody)); }
// Use this for initialization void Start() { GameObject templateBody = GameObject.Find("template"); if (templateBody != null) { mRoot = templateBody.transform; SkinnedMeshRenderer skinMesh = templateBody.GetComponentInChildren <SkinnedMeshRenderer> (); if (skinMesh != null) { mMesh = skinMesh.sharedMesh; tmpBody = new HumanBody(skinMesh.sharedMesh, skinMesh.bones, templateBody.transform); } } if (mMesh != null) { createMesh(); mIsCreate = true; } MeshFilter thisMesh = GetComponent <MeshFilter> () as MeshFilter; if (thisMesh == null) { Debug.LogError("No mesh filter"); } GameObject templateBodyLen = GameObject.Find("templateLen"); if (templateBodyLen != null) { MeshFilter tmpLenMesh = templateBodyLen.GetComponentInChildren <MeshFilter> (); if (tmpLenMesh != null) { sizeTool = new SizeAvatar(thisMesh.mesh, tmpLenMesh.mesh, tmpBody); } // SkinnedMeshRenderer tmpLenMesh = templateBodyLen.GetComponentInChildren<SkinnedMeshRenderer> (); // if (tmpLenMesh != null) { // sizeTool = new SizeAvatar (thisMesh.mesh, tmpLenMesh.sharedMesh, tmpBody); // } } initMeasurements(); reset = true; //Register Global Msg0 GlobalSignal.GlobalMsg0 = MessageManager.CreatMessage(); MessageManager.RegisterHander(GlobalSignal.GlobalMsg0, this.updateFromFile); }
private static HumanBody ParseBody(byte[] rawData, ref int startIndex) { var body = new HumanBody(); body.ID1 = ParserHelper.ToULong(rawData, ref startIndex); body.ID2 = ParserHelper.ToULong(rawData, ref startIndex); var jointCount = ParserHelper.ToInt(rawData, ref startIndex); body.joints = new List <Joint>(); for (var iVertex = 0; iVertex < jointCount; iVertex++) { body.joints.Add(ParseJoint(rawData, ref startIndex)); } return(body); }
// Constructor Function public SizeAvatar(Mesh sized, Mesh templateLen, HumanBody template) { testList = new ArrayList(); templateBody = template; sizedMesh = sized; templateMesh = template.getMesh(); templateBone = template.getBones(); mRoot = template.getTransform(); templateLenMesh = templateLen; measurement = new Dictionary <HumanSize, float> (); initMeasurements = new float[(int)HumanSize.Undefined]; planes = new ControlPlane(); mLocalPosInBone0 = new Vector3[templateMesh.vertexCount]; mLocalPosInBone1 = new Vector3[templateMesh.vertexCount]; mLocalPosInBone2 = new Vector3[templateMesh.vertexCount]; mLocalPosInBone3 = new Vector3[templateMesh.vertexCount]; templateShoulderLPos = templateBody.boneInfo [HumanBone.L_Clavicle].localPosition; templateShoulderRPos = templateBody.boneInfo [HumanBone.R_Clavicle].localPosition; updateLocalPosInBones(); initMearsurement(); }
public HumanAI(HumanBody body) { this.body = body; currentState = States.Idle; }