How can I change geometry position offset on fly?

Topics: User Forum
Mar 5, 2010 at 12:41 PM

Body body = ...

Geom geom = GeomFactory.Instance.CreateRectangleGeom(physSim, body, width, height, new Vector2(0, 100), 0f);

This is my code in short.

I can't find the way to change offset of the geometry from Vector2(0, 100) to another value.

I saw property name Position of the Geom class but it's read-only.

How can I change this in Farseer?

Thanks in advance.

 

Mar 5, 2010 at 5:21 PM

The reason it's read only is because geometry is attached to a body. I'm pretty sure geometry doesn't exist by itself as the physics engine has no concept of worldly geometrical figures when it comes to physics. If you want to change your geometry, change the body it's attached to. Unless I'm wrong then if someone could please correct me.

Mar 6, 2010 at 11:43 AM

Thanks nullsoldier.

But I just want to change position offset of the same geom with the same body.

Is there any way I can do this?

or Do I have to create a new geom and delete the old one?