コード例 #1
0
        // -----------------------------------------------------------------
        /// <summary>
        /// Compute the new position
        /// This assumes velocity is in units/sec and timestep is proportion
        /// of a second; also assumes that the position in the velocity was
        /// updated "recently enough"
        /// </summary>
        // -----------------------------------------------------------------
        protected void UpdatePosition(NBodyValue val, float timedelta)
        {
            if (!val.CanMove)
            {
                return;
            }

            SceneObjectPart sop = m_scene.GetSceneObjectPart(val.Identity);

            if (sop == null)
            {
                return;
            }

            // If the object is selected, clear the velocity and move on...
            if (sop.ParentGroup.IsSelected)
            {
                val.Velocity = Vector3.Zero;
                return;
            }

            val.Position += val.Velocity * timedelta;
            sop.UpdateGroupPosition(NBPosition2OSPosition(val.Position));
        }