public List <float> GetNormalizedObs() { obs.Clear(); // Inclination obs.Add(transform.right.y); obs.Add(transform.up.y); obs.Add(transform.forward.y); AddVectorObs(obs, AgentUtil.Sigmoid(Localize(rb.velocity))); AddVectorObs(obs, AgentUtil.Sigmoid(Localize(rb.angularVelocity))); CumlProximity = 0; Vector3 pos = transform.position; Vector3 fwd = ForwardXZ; for (int angle = -60; angle <= 60; angle += 5) { CastRay(pos, fwd, angle); } for (int angle = 75; angle <= 285; angle += 15) { CastRay(pos, fwd, angle); } return(obs); }
public override void CollectObservations() { AddVectorObs(actionsBuffer[0]); AddVectorObs(actionsBuffer[1]); AddVectorObs(actionsBuffer[2]); AddVectorObs(body.GetNormalizedObs()); // 89 RaycastResult result = head.CastRay(); hasTargetLock = result.HasHit; if (hasTargetLock) { AddVectorObs(-1f); AddVectorObs(result.NormDistance); Vector3 v = body.Localize(result.OpponentBody.VelocityXZ); AddVectorObs(AgentUtil.Sigmoid(v.x)); AddVectorObs(AgentUtil.Sigmoid(v.z)); } else { AddVectorObs(1f); AddVectorObs(1f); AddVectorObs(0f); AddVectorObs(0f); } }
public List <float> GetNormalizedObs() { obs.Clear(); // Inclination obs.Add(transform.right.y); obs.Add(transform.up.y); obs.Add(transform.forward.y); obs.Add(GetNormalizedGroundDistance()); AddVectorObs(obs, AgentUtil.Sigmoid(Localize(rb.velocity))); AddVectorObs(obs, AgentUtil.Sigmoid(Localize(rb.angularVelocity))); for (int i = 0; i < 4; i++) { AddVectorObs(obs, AgentUtil.Sigmoid(Localize(feet[i].Velocity))); obs.Add(feet[i].GetNormalizedGroundDistance()); } return(obs); }