ModelDrawer removing

Post and discuss features you'd like to see in the BEPUphysics library.
Post Reply
Peter Prins
Posts: 54
Joined: Fri Mar 11, 2011 11:44 pm

ModelDrawer removing

Post by Peter Prins » Thu Mar 22, 2012 3:17 pm

I noticed that you can add any object to the ModelDrawer, and it figures out itself whether it actually has a way to draw that object. However this advantage is kind of mitigated by the fact that the removal of objects will simply crash if the object has no drawing type. So I added this simple change to the ModelDrawer that makes it just that bit easier to use:

Code: Select all

/// <summary>
/// Removes an object from the drawer, if it exists.
/// </summary>
/// <param name="objectToRemove">Object to remove.</param>
public void Remove(object objectToRemove)
{
    try
    {
        Remove(displayObjects[objectToRemove]);
        displayObjects.Remove(objectToRemove);
    }
    catch (KeyNotFoundException) { }
}

Norbo
Site Admin
Posts: 4558
Joined: Tue Jul 04, 2006 4:45 am

Re: ModelDrawer removing

Post by Norbo » Thu Mar 22, 2012 10:39 pm

Thanks for the suggestion. The latest development version now returns a bool representing whether or not the instance had an associated display object upon removal.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest