# create permanantly static geom

This topic is 3942 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Right now what I do in the callback function is set the bodyID to 0 however I don't know which of the geoms will be set to 0 since I call the call back like so:
//main loop

dSpaceCollide(spaceID1, 0, hit);

...

void hit(void *data, dGeomID o1, dGeomID o2)
{
dBodyID body1 = dGeomGetBody(o1);
dBodyID body2 = dGeomGetBody(o2);
body2 = 0;


As you can see it's basically guess work which is which. How can I ensure the dBodyID I want to make static becomes static? I did try making it equal 0 before the callback function but I got a bad arguments error. Right now what I'm doing is going through the bodyIDs so if the bodyID is the one I want static I make it 0,
if (body1 == bodyID)
{
body1 = 0;
}
else if(body2 == bodyID)
{
body2 = 0;
}

I'm not sure if this can be regarded as a band aid fix or if this is how it should be done, I don't see it being very efficient if I have to cycle through many objects with if/then statements to find out what is static and what isn't. [Edited by - chillypacman on May 6, 2007 3:04:30 AM]

##### Share on other sites
You really need to be more specific. What library is that? Is it physics or graphics?

##### Share on other sites
When you create a geom, you simply don't attach it to any body (that is, leave the geom's body id to default, which is 0). Check the FAQ entry.

##### Share on other sites
@Kylotan

Sorry, I was using Ode, it's the only library I've used besides directx so I'm not sure if it looks similar to other libraries or not.

@Kylotan, I guess that makes sense. The thing is when you assign a geom to a body it takes its location as well which makes things that much easier to work with.

Though in hindsight static geoms don't move so they need not be assigned to body's.

I did read the FAQ, bleh, ok, now I see it, I thought you had to associate it with a body of zero, not just leave it alone so it could set itself to 0.

Thanks :-)