예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (_shipController == null)
        {
            return;
        }

        // determine the gravitational force on the ship from each planet
        for (int i = 0; i < _stellarBodyModels.Count; i++)
        {
            float   massPlanet     = _stellarBodyModels[i].mass;
            Vector3 positionPlanet = _stellarBodyModels[i].transform.position;

            // apply the force
            _shipController.ApplyGravity(massPlanet, positionPlanet);

            _asteroidController.ApplyGravity(massPlanet, positionPlanet);
        }
    }