Esempio n. 1
0
        private HistoryBuffer AllocateHistory()
        {
            HistoryBuffer history = this.historyPool.Allocate();

            history.Initialize(this.HistoryLength);
            return(history);
        }
Esempio n. 2
0
        /// <summary>
        /// Full reset. Clears out all data for pooling. Call FreeShapes() first.
        /// </summary>
        private void Reset()
        {
            VoltDebug.Assert(this.shapeCount == 0);

#if DEBUG
            this.IsInitialized = false;
#endif

            this.UserData        = null;
            this.World           = null;
            this.BodyType        = VoltBodyType.Invalid;
            this.CollisionFilter = null;

            this.Angle           = 0.0f;
            this.LinearVelocity  = TSVector2.zero;
            this.AngularVelocity = 0.0f;

            this.Force  = TSVector2.zero;
            this.Torque = 0.0f;

            this.Mass       = 0.0f;
            this.Inertia    = 0.0f;
            this.InvMass    = 0.0f;
            this.InvInertia = 0.0f;

            this.BiasVelocity = TSVector2.zero;
            this.BiasRotation = 0.0f;

            this.history      = null;
            this.currentState = default(HistoryRecord);
        }
Esempio n. 3
0
 internal void FreeHistory()
 {
     if ((this.World != null) && (this.history != null))
     {
         this.World.FreeHistory(this.history);
     }
     this.history = null;
 }
Esempio n. 4
0
        /// <summary>
        /// Used for saving the body as part of another structure. The body
        /// will retain all geometry data and associated metrics, but its
        /// position, velocity, forces, and all related history will be cleared.
        /// </summary>
        internal void PartialReset()
        {
            this.history      = null;
            this.currentState = default(HistoryRecord);

            this.LinearVelocity  = TSVector2.zero;
            this.AngularVelocity = 0.0f;

            this.Force  = TSVector2.zero;
            this.Torque = 0.0f;

            this.BiasVelocity = TSVector2.zero;
            this.BiasRotation = 0.0f;
        }
Esempio n. 5
0
 internal void FreeHistory(HistoryBuffer history)
 {
     this.historyPool.Deallocate(history);
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes the buffer for storing past body states/spaces.
 /// </summary>
 internal void AssignHistory(HistoryBuffer history)
 {
     VoltDebug.Assert(this.IsStatic == false);
     this.history = history;
 }