Sign in to follow this  
chillypacman

create permanantly static geom

Recommended Posts

chillypacman    100
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 this post


Link to post
Share on other sites
chillypacman    100
@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 :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this