public override void InitializeAgent() { m_JdController = GetComponent <JointDriveController>(); m_JdController.SetupBodyPart(hips); m_JdController.SetupBodyPart(chest); m_JdController.SetupBodyPart(spine); m_JdController.SetupBodyPart(head); m_JdController.SetupBodyPart(thighL); m_JdController.SetupBodyPart(shinL); m_JdController.SetupBodyPart(footL); m_JdController.SetupBodyPart(thighR); m_JdController.SetupBodyPart(shinR); m_JdController.SetupBodyPart(footR); m_JdController.SetupBodyPart(armL); m_JdController.SetupBodyPart(forearmL); m_JdController.SetupBodyPart(handL); m_JdController.SetupBodyPart(armR); m_JdController.SetupBodyPart(forearmR); m_JdController.SetupBodyPart(handR); m_HipsRb = hips.GetComponent <Rigidbody>(); m_ChestRb = chest.GetComponent <Rigidbody>(); m_SpineRb = spine.GetComponent <Rigidbody>(); m_RayPer = GetComponent <RayPerception>(); m_targetRb = target.GetComponent <Rigidbody>(); // var academy = FindObjectOfType<NavAcademy>(); // m_ResetParams = academy.resetParameters; // SetResetParameters(); }
public override void InitializeAgent() { base.InitializeAgent(); rayPer = GetComponent <RayPerception>(); agentRB = GetComponent <Rigidbody>(); targetRB = target.GetComponent <Rigidbody>(); }
void start() { SetReward(1.0f); base.InitializeAgent(); m_AgentRb = GetComponent <Rigidbody>(); m_RayPer = GetComponent <RayPerception>(); }
public override void CollectObservations() { var rayDistance = 12f; //============================ 2-7 ======================= //float[] rayAngles = { 0f, 15f, 30f, 45f, 60f, 75f, 90f, 105f, 120f, 135f, 150f, 165f, 180f }; //var detectableObjects = new[] { "Infectee" }; //AddVectorObs(rayPer.Perceive(rayDistance, rayAngles, detectableObjects, 0f, 0f)); //AddVectorObs(shootPoint.forward); //AddVectorObs(playerRb.angularVelocity); //============================ 2-13 ====================== //float[] rayAngles = { 0f, 15f, 30f, 45f, 60f, 75f, 90f, 105f, 120f, 135f, 150f, 165f, 180f }; //var detectableObjects = new[] { "Infectee", "wall", "Player" }; //AddVectorObs(rayPer.Perceive(rayDistance, rayAngles, detectableObjects, 0f, 0f)); //AddVectorObs(shootPoint.forward); //AddVectorObs(playerRb.angularVelocity); //============================ 2-14 ~ 15 ====================== //float[] rayAngles = { 0f, 15f, 30f, 45f, 60f, 75f, 90f, 105f, 120f, 135f, 150f, 165f, 180f }; //var detectableObjects = new[] { "Infectee", "wall", "Player" }; //endPos = Vector3.Normalize(transform.TransformDirection( // RayPerception.PolarToCartesian(12, 90))); //AddVectorObs(rayPer.Perceive(rayDistance, rayAngles, detectableObjects, 0f, 0f)); //AddVectorObs(Vector3.Dot(transform.forward, endPos)); //AddVectorObs(playerRb.angularVelocity); //============================ 2-16 ====================== //float[] rayAngles = { 0, 90f, 180f, 270f, 360f }; //var detectableObjects = new[] { "Infectee", "wall", "Player" }; //endPos = Vector3.Normalize(transform.TransformDirection( // RayPerception.PolarToCartesian(12, 90))); //AddVectorObs(rayPer.Perceive(rayDistance, rayAngles, detectableObjects, 0f, 0f)); //AddVectorObs(Vector3.Dot(transform.forward, endPos)); //AddVectorObs(playerRb.angularVelocity); //============================ 2-17 ====================== float[] rayAngles = { 85f, 87f, 90f, 92f, 95f }; var detectableObjects = new[] { "Infectee", "wall", "Player" }; endPos = Vector3.Normalize(transform.TransformDirection( RayPerception.PolarToCartesian(12, 90))); AddVectorObs(rayPer.Perceive(rayDistance, rayAngles, detectableObjects, 0f, 0f)); AddVectorObs(Vector3.Dot(transform.forward, endPos)); //AddVectorObs(playerRb.angularVelocity); //AddVectorObs(playerTr.position); }
public override void InitializeAgent() { base.InitializeAgent(); agentRB = GetComponent <Rigidbody>(); rayPer = GetComponent <RayPerception>(); myAcademy = myAcademyObj.GetComponent <RatSpawningAcademy>(); }
/////////////////////////// ////////////////////////////////////////////////////////////////////////// public override void InitializeAgent() { //Debug.LogWarning("INIT CALLED"); infoScript = InfoScript.instance; base.InitializeAgent(); _rayPercept = GetComponent <RayPerception>(); agentRB = GetComponent <Rigidbody>(); _renderer = GetComponent <MeshRenderer>(); _moveSpeed = infoScript.moveSpeed_playerAgent; _turnDegree = infoScript.turnDegree_playerAgent; _rayDistance = infoScript.rayDistacne_agent; _shotAngle = infoScript.shotDegree; _shotRange = infoScript.shotRange; _hitDmg = infoScript.dmg_playerAgent; //_rayAngle = infoScript.rayAngle_agent; _hp = infoScript.fullHp_playerAgent; _renderer.material = infoScript.GetHP_Material(false, _hp); _shotCoolTime = infoScript.shotCoolTime_playerAgent; _curState = AgentState.shotReady; ResetAgentValue(); }
public override void InitializeAgent() { base.InitializeAgent(); rayPerception = GetComponentInChildren <RayPerception>(); //Brain characterBrain = FindObjectOfType<Brain>(); //GiveBrain(characterBrain); }
public override void InitializeAgent() { base.InitializeAgent(); wallDetect = GetComponent <WallDetect>(); wallDetect.agent = this; rayPer = GetComponent <RayPerception>(); }
void Start() { playerController = GetComponent <PlayerControllerSquare>(); agentRb = GetComponent <Rigidbody>(); rayPer = GetComponent <RayPerception>(); envAcademy = FindObjectOfType <TestAcademy>(); }
public override void InitializeAgent() { agentRB = GetComponent <Rigidbody>(); academy = FindObjectOfType <BattleFSAcademy>(); PlayerStateBFS playerState = new PlayerStateBFS(); playerState.workerScript = this; if (gameObject.tag == "redAgent") { playerState.team = "red"; team = Team.red; needGoal = GoalYellow; } else { playerState.team = "yellow"; team = Team.yellow; needGoal = GoalRed; } area.playerStates.Add(playerState); tagAgent = gameObject.tag; teamColor = teamMat.color; bodyColor = bodyMat.color; Renderer rend = gameObject.GetComponentInChildren <Renderer>() as Renderer; agentTeamMat = rend.material; startPos = transform.position; startRot = transform.rotation; whoWin = "coming"; agentRB.centerOfMass = new Vector3(0, academy.centerOfMass, 0); radiusTarget = academy.radiusTarget; rayPer = GetComponent <RayPerception>(); }
public override void InitializeAgent() { base.InitializeAgent(); rayPer = GetComponent <RayPerception>(); agentRB = GetComponent <Rigidbody>(); currentAction = "Idle"; }
// Start is called before the first frame update void Start() { rigid = GetComponent <Rigidbody>(); FloorTrans = transform.parent.GetChild(0).transform; rayPer = GetComponent <RayPerception>(); detectableObjects = new string[] { "wall", "Goal", "block" }; }
bool detect_agent() { // 전면 시야각 30도로 상대를 포착 float[] angle_list = new float[] { 87.5f, 75f, 80f, 85f, 90f, 95f, 100f, 105f, 92.5f }; RaycastHit hit; bool result = false; foreach (float item in angle_list) { Vector3 position = transform.TransformDirection(RayPerception.PolarToCartesian(25f, item)); origin = transform.position; direction = position; Debug.DrawRay(transform.position, position, Color.blue, 0f, true); if (Physics.SphereCast(transform.position, 0.1f, position, out hit, 25f)) { if (hit.collider.gameObject.CompareTag("agent")) { result = true; } } } return(result); }
void Start() { rayPer = GetComponent <RayPerception3D> (); //distanceToTarget2 = Vector3.Distance(this.transform.localPosition, // Target.localPosition); rBody = GetComponent <Rigidbody>(); }
// Start is called before the first frame update void Start() { m_vehicle = GetComponent <Vehicle>(); m_rayPerception = GetComponent <RayPerception>(); maxSpeed = m_vehicle.maxSpeed; isPlaner = m_vehicle.isPlaner; }
public override void InitializeAgent() { base.InitializeAgent(); goalDetect = block.GetComponent <GoalDetect>(); goalDetect.agent = this; rayPer = GetComponent <RayPerception>(); localDifficulty = academy.difficulty; scanAgent = GetComponent <ScanAgent>(); SetActive(true); if (academy.useScan) { SetActive(false); scanAgent.SetActive(true); } else { scanAgent.SetActive(false); } // Cache the agent rigidbody agentRB = GetComponent <Rigidbody>(); // Cache the block rigidbody blockRB = block.GetComponent <Rigidbody>(); // Get the ground's bounds areaBounds = ground.GetComponent <Collider>().bounds; // Get the ground renderer so we can change the material when a goal is scored groundRenderer = ground.GetComponent <Renderer>(); // Starting material groundMaterial = groundRenderer.material; }
// Start is called before the first frame update private void Start() { rbd = GetComponent <Rigidbody>(); rayPer = GetComponent <RayPerception>(); startPos = transform.position; startRot = transform.eulerAngles; }
public override void InitializeAgent() { rBody = GetComponent <Rigidbody>(); mAudioSource = GetComponent <AudioSource>(); rayPerception = GetComponent <RayPerception>();; done = false; }
void Start() { rb = GetComponent <Rigidbody>(); ballrb = Ball.GetComponent <Rigidbody>(); rp = GetComponent <RayPerception>(); bound = inputBound.bounds; mat = Set.GetComponent <Renderer>().material; }
public override void InitializeAgent() { base.InitializeAgent(); _rayPer = GetComponent <RayPerception>(); CarControl = GetComponent <Car>(); CarControl.ControlAI = true; _originalTransform = rb.transform; }
/// <summary> /// Initialize the agent eg. initialize agents attributes with objects found on the scene. /// This method should be called one time before the training starts. /// </summary> public override void InitializeAgent() { base.InitializeAgent(); agentRigidbody = GetComponent <Rigidbody>(); rayPerception = GetComponent <RayPerception>(); goall = GameObject.Find("Goal"); agentArea = transform.parent.GetComponent <AgentArea>(); }
public override void InitializeAgent() { base.InitializeAgent(); m_AgentRb = GetComponent <Rigidbody>(); m_MyArea = area.GetComponent <PyramidArea>(); m_RayPer = GetComponent <RayPerception>(); m_SwitchLogic = areaSwitch.GetComponent <PyramidSwitch>(); }
/// <summary> /// Initialize the agent /// </summary> public override void InitializeAgent() { base.InitializeAgent(); agentAcademy = FindObjectOfType <DogAcademy>(); agentArea = transform.parent.GetComponent <DogArea>(); agentRigidbody = GetComponent <Rigidbody>(); rayPerception = GetComponent <RayPerception>(); }
// Start is called before the first frame update void Start() { m_vehicle = GetComponent <Vehicle>(); m_rayPerception = GetComponent <RayPerception>(); maxSpeed = m_vehicle.maxSpeed; isPlaner = m_vehicle.isPlaner; circleTarget = new Vector3(wanderRadius * 0.707f, 0, wanderRadius * 0.707f); }
void Start() { rBody = GetComponent <Rigidbody>(); rayPer = GetComponent <RayPerception>(); objectName = gameObject.name; GunMaterial = Gun.GetComponent <Renderer>().material; BodyMaterial = gameObject.GetComponent <Renderer>().material; TargetMaterial = Target.GetComponent <Renderer>().material; }
public override void InitializeAgent() { base.InitializeAgent(); agentRB = GetComponent <Rigidbody>(); Monitor.verticalOffset = 1f; myArea = area.GetComponent <HungryArena>(); rayPer = GetComponent <RayPerception>(); myAcademy = FindObjectOfType <HungryAcademy>(); }
public override void InitializeAgent() { base.InitializeAgent(); agentRb = GetComponent <Rigidbody>(); Monitor.verticalOffset = 1f; myArea = area.GetComponent <BananaArea>(); rayPer = GetComponent <RayPerception>(); myAcademy = myAcademyObj.GetComponent <BananaAcademy>(); }
public override void InitializeAgent() { base.InitializeAgent(); m_Academy = FindObjectOfType <HallwayAcademy>(); m_RayPer = GetComponent <RayPerception>(); m_AgentRb = GetComponent <Rigidbody>(); m_GroundRenderer = ground.GetComponent <Renderer>(); m_GroundMaterial = m_GroundRenderer.material; }
void Start() { m_manager = transform.parent.GetComponent <GameObjectManager>(); m_rayPerception = GetComponent <RayPerception>(); m_vehicle = GetComponent <Vehicle>(); isPlaner = m_vehicle.isPlaner; maxSpeed = m_vehicle.maxSpeed; }
public override void InitializeAgent() { base.InitializeAgent(); rBody = GetComponent <Rigidbody>(); navMeshAgent = GetComponent <NavMeshAgent>(); navMeshAgent.updatePosition = false; navMeshAgent.updateRotation = false; rayPer = GetComponent <RayPerception>(); }