Example #1
0
        /// <summary>
        /// Updates a single body, resolving only collisions with that body.
        /// If a frame number is provided, all dynamic bodies will store their
        /// state for that frame for later testing.
        ///
        /// Note: This function is best used with dynamic collisions disabled,
        /// otherwise you might get symmetric duplicates on collisions.
        /// </summary>
        public void Update(VoltBody body, bool collideDynamic = false)
        {
            if (body.IsStatic)
            {
                VoltDebug.LogWarning("Updating static body, doing nothing");
                return;
            }

            body.Update();
            this.dynamicBroadphase.UpdateBody(body);
            this.BroadPhase(body, collideDynamic);

            this.UpdateCollision();
            this.FreeManifolds();
        }
Example #2
0
        /// <summary>
        /// Ticks the world, updating all dynamic bodies and resolving collisions.
        /// If a frame number is provided, all dynamic bodies will store their
        /// state for that frame for later testing.
        /// </summary>
        public void Update()
        {
            for (int i = 0; i < this.bodies.Count; i++)
            {
                VoltBody body = this.bodies[i];
                if (body.IsStatic == false)
                {
                    body.Update();
                    this.dynamicBroadphase.UpdateBody(body);
                }
            }

            this.BroadPhase();

            this.UpdateCollision();
            this.FreeManifolds();
        }