Forgot to mention Vertices.SubDivideEdges

Coordinator
Feb 13, 2008 at 12:58 AM
In my blog post about the new features of Farseer, I missed one item. I've since updated the post. Here it is for convenience.

  • Finally implemented Vertices.SubDivideEdges(float maxEdgeLength) method
    • Farseer prefers an even spread of vertices even on straight edges. This method makes it to take any set of vertices and sub-divide the edges so that no edge is longer than some given length.
Feb 13, 2008 at 7:12 PM
AWESOME!
Feb 13, 2008 at 7:25 PM
Edited Feb 13, 2008 at 7:25 PM
For the next version could you add the following to the Controller class so that we can enable / disable the Springs?

protected bool isEnabled = true;
public bool Enabled
{
get { return isEnabled; }
set { isEnabled = value; }
}

And in the PhysicsSimulator.cs:

private void ApplyForces(float dt) {
for (int i = 0; i < controllerList.Count; i++) {

if (!controllerListi.Enabled)
{
continue;
}
...
Coordinator
Feb 13, 2008 at 8:39 PM
Yeah, I can add that. I'll make a note.
Coordinator
Feb 14, 2008 at 11:11 AM
Ok, the Enable property has been added to the controller class for the next release.
Feb 14, 2008 at 4:09 PM

crashlander wrote:
Ok, the Enable property has been added to the controller class for the next release.


Brilliant, thanks.
Feb 14, 2008 at 6:49 PM
One thing to note, in order for the Vertices.SubDivideEdges to work with the PhysicsSimulatorView turned on I had to do the following:

geom.LocalVertices.SubDivideEdges(50);
geom.SetVertices(geom.LocalVertices); -- Needs to do this to update the WorldVertices otherwise you get an index out of bounds error
Coordinator
Feb 15, 2008 at 5:29 PM
Ok. I never tested it while running the simulator. This was something I was more considering for inially setting things up.