コード例 #1
0
        ///this can be useful to synchronize a single rigid body . graphics object
        public void SynchronizeSingleMotionState(RigidBody body)
        {
            Debug.Assert(body != null);

            if (body.GetMotionState() != null && !body.IsStaticOrKinematicObject())
            {
                //we need to call the update at least once, even for sleeping objects
                //otherwise the 'graphics' transform never updates properly
                ///@todo: add 'dirty' flag
                //if (body.getActivationState() != ISLAND_SLEEPING)
                {
                    IndexedMatrix interpolatedTransform;
                    TransformUtil.IntegrateTransform(body.GetInterpolationWorldTransform(),
                                                     body.SetInterpolationLinearVelocity(), body.GetInterpolationAngularVelocity(),
                                                     m_localTime * body.GetHitFraction(), out interpolatedTransform);
                    body.GetMotionState().SetWorldTransform(ref interpolatedTransform);
                }
            }
        }