Voxelizing a model results in entities expanding volume?!
Posted: Sun Jan 02, 2011 6:47 pm
I'm importing a simple cube model and "voxelizing" it in order to create 100s of small equally sized cubes from the original model mesh.
The voxel constructor is as follows:
The weird thing is that all the voxels don't stay put and instead expand away from each other. I thought they might be overlapping but I have tried reducing the size by the Default Margin and still nothing.
Why is this happening?

The voxel constructor is as follows:
Code: Select all
public Voxel(Game1 game, Vector3 position, float size, Vector4 colour)
{
this.colour = colour;
this.game = game;
this.size = size;
colourTimer = new LerpTimer(1f, 0f, 2000);
// Reduce size by a small amount based on collision margins
// This prevent the voxel from overlapping neighbouring voxels when created
size -= game.Space.SimulationSettings.CollisionDetection.DefaultMargin;
// Entity can be obtained from EntityPool
entity = new Box(position, size, size, size, 1);
entity.IsAffectedByGravity = false;
game.Space.Add(entity);
}
Why is this happening?
