Bug - Updating CollisionInformation on a MorphableEntity does not cause the ModelDrawer to update the mesh data for that entity
From debugging, the InstanceModelDrawer (and I presume others) only captures the collision information mesh when the entity is added to the drawer.
In order to get around that, I decided to remove my entity from the drawer and then immediately add it back. It turns out this doesn't work because of a bug. The following code from ModelDrawer.cs fails because the objectToDisplay is still in the displayObjects collection even after calling Remove.
Code: Select all
public ModelDisplayObjectBase Add(object objectToDisplay)
{
ModelDisplayObjectBase displayObject = GetDisplayObject(objectToDisplay);
if (displayObject != null)
{
Add(displayObject);
displayObjects.Add(objectToDisplay, displayObject);
return displayObject;
}
return null; //Couldn't add it.
}
Old Code:
Code: Select all
public void Remove(object objectToRemove)
{
Remove(displayObjects[objectToRemove]);
}
Code: Select all
public void Remove(object objectToRemove)
{
Remove(displayObjects[objectToRemove]);
displayObjects.Remove(objectToRemove);
}