Code: Select all
box = new Box(position, size, size, size, 1);
Code: Select all
        public void Spawn(Matrix worldTransform)
        {
            isValid = true;
            colourTimer.Reset();
            colourTimer.Start();
            box.WorldTransform *= worldTransform;
            // Force inertia tensor to update
            box.BecomeDynamic(box.Mass);                    // Can change collision group
            box.IsAffectedByGravity = false;
            game.Space.Add(box);
        }
Code: Select all
        public void Kill()
        {
            isValid = false;
        
            colourTimer.Stop();
            // Reset entity (remove all forces)
            box.LinearVelocity = new Vector3();
            box.AngularVelocity = new Vector3();
            box.WorldTransform = Matrix.Identity;
            game.Space.Remove(box);
        }
How can this be avoided with pooled entities?An item with the same key has already been added.
