Make Entity empty constructor public
Posted: Fri May 21, 2010 3:59 pm
Hi Norbo,
I don't know if it would deeply go against your lib rules but if you could make the empty Entity constructor public instead it would help me (us?) a lot to do some special things such as creating/updating collision ConvexHulls, CompoundBodies and the like in an editor and save/load them using File I/O operations to improve loading performances for instance
It would also allow us to create one Entity using the standard method, store it in a Static field or property and copy its values directly instead of computing them. Today, if I have a ShipEntity class holding a ConvexHull property, and if I want to create a scene with 100 of them, each initialization would take some time.
With such simple feature, I would simply create my first ConvexHull and create a new instance with it.
I don't know what it would take you to add this coding feature but that would be great at least for me :p
Otherwise, you could also provide something like:
public abstract class Entity
{
public ConvexHull(ConvexHull instance)
{
if(instance == null)
throw new ArgumentException("blabla");
// for each property/field that needs to be set, copy from instance :p
}
}
We would then be able to:
ConvexHull firstInstance = new ConvexHull(myVectorList, 10);
ConvexHull anotherInstance = new ConvexHull(firstInstance);
I don't know if it would deeply go against your lib rules but if you could make the empty Entity constructor public instead it would help me (us?) a lot to do some special things such as creating/updating collision ConvexHulls, CompoundBodies and the like in an editor and save/load them using File I/O operations to improve loading performances for instance
It would also allow us to create one Entity using the standard method, store it in a Static field or property and copy its values directly instead of computing them. Today, if I have a ShipEntity class holding a ConvexHull property, and if I want to create a scene with 100 of them, each initialization would take some time.
With such simple feature, I would simply create my first ConvexHull and create a new instance with it.
I don't know what it would take you to add this coding feature but that would be great at least for me :p
Otherwise, you could also provide something like:
public abstract class Entity
{
public ConvexHull(ConvexHull instance)
{
if(instance == null)
throw new ArgumentException("blabla");
// for each property/field that needs to be set, copy from instance :p
}
}
We would then be able to:
ConvexHull firstInstance = new ConvexHull(myVectorList, 10);
ConvexHull anotherInstance = new ConvexHull(firstInstance);