Esempio n. 1
0
        public virtual void SaveKinematicState(float timeStep)
        {
            ///would like to iterate over m_nonStaticRigidBodies, but unfortunately old API allows
            ///to switch status _after_ adding kinematic objects to the world
            ///fix it for Bullet 3.x release

            int length = m_collisionObjects.Count;

            for (int i = 0; i < length; ++i)
            {
                RigidBody body = RigidBody.Upcast(m_collisionObjects[i]);
                if (body != null && body.GetActivationState() != ActivationState.ISLAND_SLEEPING)
                {
                    if (body.IsKinematicObject())
                    {
                        //to calculate velocities next frame
                        body.SaveKinematicState(timeStep);
                    }
                }
            }
        }