예제 #1
0
    public void Update()
    {
        if (orbit == true)
        {
            if (Application.isPlaying == true)
            {
                orbitAngle += SGT_Helper.RadiansPerSecond(orbitPeriod) * Time.deltaTime;
            }

            var targetPosition = SGT_Helper.PolarToCartesian(new Vector2(orbitAngle, 0.0f)) * orbitDistance; targetPosition.x *= (1.0f - orbitOblateness);

            SGT_Helper.SetLocalPosition(transform, targetPosition);
        }

        if (rotation == true)
        {
            if (Application.isPlaying == true)
            {
                transform.Rotate(rotationAxis, SGT_Helper.DegreesPerSecond(rotationPeriod) * Time.deltaTime, Space.Self);
            }
        }
    }