This project has moved and is read-only. For the latest updates, please go here.


Topics: Developer Forum, User Forum
Oct 11, 2009 at 5:20 AM

Hey guys,

I am currently using the ComplexFactory to make paths. and allthough there is a path.AddToPhysicsSimulator()

there is no corresponding RemoveFromPhysicsSimulator().


It would be nice if this was added, however in the mean-time how should i go about completely removing all traces of my path from the simulator (i want to remove all references so it is garbage collected).



p.s. what is the difference between CreateRope() and CreateChain()?


Oct 11, 2009 at 3:28 PM

I've added a RemoveFromPhysicsSimulator() method. To remove it yourself you will have to access all the bodies, geometries, springs and joints that makes up the path and remove each of them from the physics simulator.

The difference between the two should have been the joint used. But I can see that we chose to let the user choose the link type instead. I will clean up the code and see what I can do to make it easier to use. Right now CreateRope() has no purpose.

Oct 12, 2009 at 2:18 AM

Thanks for the fast response.

i have some other questions that i will put here instead of starting a new thread, but they are slightly unrelated

I am currently creating 1 large geom that encompases the whole rope, by creating a static geom and using the setVertices method and set position members. (i am no longer using the ComplexFactory so that i can create the path without geoms).

However i have various problems in my game (which i assume is because of this).

i have a Ball (a simple circle Body+Geom) which will roll down the rope (path) fine.however:

#1) when i use the geom.Collide method on the rope geom it never returns true. however using it on other geoms in my game works.

#2) i have a fairly significant problem with tunneling as soon as the rope moves with any speed (the ball falls through the rope). This may be normal (not related to #1), but i can't seem to find a way to fix it. Is CCD enabled in the current source? i couldn't seem to find any properties relating to it, even know i have read discussions about it being there.


Oct 12, 2009 at 2:25 AM

1. The path contains several geometries. It is way better to use the Geom.OnCollision event than using Geom.Collide().

2. Tunneling is normal when you have thin objects and/or high velocity objects. We have no CCD option in the current release. The options of getting around CCD is described in the manual. The discussions you have read are probably about 3.0, it is still work in progress.

Oct 12, 2009 at 2:29 AM

1. I was using Geom.Collide() to determine if a particular point (the location of the mouse) was inside the geom. I assume i cannot use Geom.OnCollision() to do this.

2. Sorry i should have explained better. I meant in the current source version (3.0).

Oct 12, 2009 at 2:33 AM

1. Yes, you need Geom.Collide() for that. You need to test against all geometries in the path for it to work.

2.  Geom.Collide() and the like only exists in 2.x version of Farseer Physics Engine. And it does not have CCD. Only 3.0 have CCD and it is not in a usable state right now.

Oct 12, 2009 at 2:43 AM

1. I currently have only 1 geometry covereing the whole "rope". NB: that i am not using the Path or ComplexFactory classes anymore, and am creating all the bodies and joints manually, and then creating one large Geom to cover the whole "rope" using the method i described above (using SetVertices() and setting Position manually in every frame on a Geom with the IsStatic property set to true). And this seems to cause the Geom.Collide() to no longer work (even know it works on the other Geoms in my game created using the GeomFactory). Geom.CollideAll() does not return any geoms either (at a point over my rope).

2. I see. I had the latest source, but i was using the classes from the "2.1" folder, which is why i didn't see any difference.

Oct 12, 2009 at 2:49 AM

In that case I'm not sure what went wrong. If you use PhysicsSimulator.Collide() it will test all geometries against the vector you give it - it should return the geometry as long as it is included in the physics simulator. You can try using the PhysicsSimulatorView to visualize the geometry and see if it is positioned correctly.


Oct 14, 2009 at 4:44 PM

I got it working by removing the existing geom from the simulator and creating a new one at each frame. but i would assume this isn't the most ideal solution in terms of performance.

I think my problem is that when i use Geom.SetVertices() i am passing vertices in world coordinates, but i think i need to pass them as local coordinates (relative to the centroid) and set the Body.Position differently so that they are in the right place.

I will try playing with this next time i have time.

Does this sound right?

Oct 18, 2009 at 9:30 AM

I got it working by setting the body position back to Vector2.Zero, and the calling SetVertices() with local coordinates (relevant to the centroid/body's center) and then set position back to the world location of the body/geom.

i assume that SetVertices() was only designed to be used when first initializing the geom before you set the bodies position. but it would be handy if it could work later after the body has been moved (without having to jump through these hoops)