KLF.KLFVessel.updatePosition C# (CSharp) Method

updatePosition() public method

public updatePosition ( ) : void
return void
        public void updatePosition()
        {
            if (!orbitValid)
                return;

            gameObj.transform.localPosition = worldPosition;

            Vector3 scaled_pos = ScaledSpace.LocalToScaledSpace(worldPosition);

            //Determine the scale of the line so its thickness is constant from the map camera view
            float apparent_size = 0.01f;
            bool pointed = true;
            switch (info.state)
            {
                case State.ACTIVE:
                    apparent_size = 0.015f;
                    pointed = true;
                    break;

                case State.INACTIVE:
                    apparent_size = 0.01f;
                    pointed = true;
                    break;

                case State.DEAD:
                    apparent_size = 0.01f;
                    pointed = false;
                    break;

            }

            float scale = (float)(apparent_size * Vector3.Distance(MapView.MapCamera.transform.position, scaled_pos));

            //Set line vertex positions
            Vector3 line_half_dir = worldDirection * (scale * ScaledSpace.ScaleFactor);

            if (pointed)
            {
                line.SetWidth(scale, 0);
            }
            else
            {
                line.SetWidth(scale, scale);
                line_half_dir *= 0.5f;
            }

            line.SetPosition(0, ScaledSpace.LocalToScaledSpace(worldPosition - line_half_dir));
            line.SetPosition(1, ScaledSpace.LocalToScaledSpace(worldPosition + line_half_dir));

            if (!situationIsGrounded(info.situation))
                orbitRenderer.driver.orbit.UpdateFromUT(adjustedUT);
        }