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

repositioning a geom mid game

Mar 23, 2009 at 7:59 PM
for my game i am in need of a geom that I could reposition relative to the body.
So i have a 'geom' that follows a 'body'. During the game i would like to have the ability to move the 'geom' so that it can be repositioned to the right of the 'body or the left of the 'body.

one way of doing this i would imagine is to have a second body 'body2' with a geom on it. each frame i will reposition 'body2' so that its located directly on top of 'body1'. that way i would be able to reposition the 'body2' relative to 'body1' to accomplish the desired effect. I would hopefully like to achieve this without creating a second 'body'.

Mar 23, 2009 at 9:38 PM
You can just reposition the body manually. You just have to beware of a few things:

No physics-related properties are correctly set if you position it yourself. There is no velocity on the and thus if the geometry collide with something, weird physics will happen. You need to get all other geometries out of the way first so that it does not collide with anything.
Mar 24, 2009 at 12:53 AM
Uh, i think that kinda defeats the point... I'm pretty sure he wants the geom to be able to collide as well. *goes and looks at the geoms properties* Well you could keep that second body on hand and then call Geom.SetBody(the second body) when you need to  move it. I think that will work but im not sure.