Exemplo n.º 1
0
        public void SetPath(TruePath path)
        {
            var lineRenderer = GetComponent <LineRenderer>();

            var positions = path.GetPositions();

            lineRenderer.positionCount = positions.Length;
            lineRenderer.SetPositions(positions);

            m_currentColor = m_normalColor;
            UpdateColor();
        }
Exemplo n.º 2
0
        private void CreateTruePath(SimulatedObject target)
        {
            var dt   = Time.fixedDeltaTime;
            var time = 0.0f;

            // m_targetPath = ScriptableObject.CreateInstance<TruePath>();

            m_player.BeginSimulation();
            if (!Application.isPlaying)
            {
                foreach (var planet in FindObjectsOfType <CelestialBody>())
                {
                    planet.RegisterBody();
                }
            }

            m_targetPath.Clear();

            RecordState(target, time);

            while (time < m_maxTime)
            {
                SimulateStep(target);
                time += dt;
                target.UpdateObject(dt);

                RecordState(target, time);
            }

            if (!Application.isPlaying)
            {
                foreach (var planet in FindObjectsOfType <CelestialBody>())
                {
                    planet.UnregisterBody();
                }
            }
            m_player.EndSimulation();

            Debug.Log($"Created path with {m_targetPath.GetPositions().Length} points");
        }
Exemplo n.º 3
0
 public void SetPath(TruePath path)
 {
     Debug.Log($"PathFollower: path set with {path.GetPositions().Length} points");
     m_path = path;
     m_time = 0.0f;
 }