private void Start() { rb = GetComponent <Rigidbody>(); rb.velocity = Vector3.zero; controller = GetComponent <RigidbodyController>(); controller.controlledByAgent = true; startPos = transform.position; startRotation = transform.rotation; milestones = milestonesParent.GetComponentsInChildren <TrackMilestone>(); goal = FindObjectOfType <Goal>(); target = goal; if (showGUI) { debugGUI = new DebugGUI(); } }
public override void OnEpisodeBegin() { rb.MovePosition(startPos); rb.MoveRotation(startRotation); rb.velocity = Vector3.zero; controller.UpdateFromAgent(0, 0, 0); numHitMilestones = 0; target = goal; foreach (var milestone in milestones) { if (milestone.enteredPlayers.Contains(this)) { milestone.enteredPlayers.Remove(this); } } standStillStopwatch = null; }