Hi David,
Sorry, I did not look into your example.
To be honest, I (almost) never look into test cases like these since I have little experience with building ODE object structures and it would require me studying ODE API as well.
Why would not you check demo applications included with the library first? Like most of the application libraries, ODE requires initialization and finalization calls (which are missing from your source).
Oleh Derevenko
-- Skype with underscore
GPG Key Fingerprint: 2F56 32DC DCD9 B2BB 06E9 39E8 A37E 5E60 376E C691
From: ode-...@googlegroups.com <ode-...@googlegroups.com> On Behalf Of David Guillen
Sent: Sunday, July 26, 2020 10:00 PM
To: ode-users <ode-...@googlegroups.com>
Subject: Re: Re: [ode-users] Bug in QuadTree space?
Hey there!
Just a ping on this. Oleh: do you think this is a bug or is it "working as intended"?
I'm a bit confused with the API so if you could clarify... I might have some time to debug the issue if you confirm this is non-intended behaviour.
Thanks!
#include <ode/ode.h>
int main(int argc, char **argv) {
float t[3] = {0,0,0};
auto world = dWorldCreate();
dWorldSetQuickStepNumIterations(world, 10);
auto space = dSimpleSpaceCreate(0);
dReal d[3] = {10, 10, 10};
auto world_space = dQuadTreeSpaceCreate(space, t, &d[0], 5);
dSpaceID subspace = dSimpleSpaceCreate(space);
dSpaceID subspace2 = dSimpleSpaceCreate(space);
dSpaceID subspace3 = dSimpleSpaceCreate(space);
dSpaceID subspace4 = dSimpleSpaceCreate(world_space); // Comment out these two lines
dSpaceID subspace5 = dSimpleSpaceCreate(world_space); // to make it work
auto body = dBodyCreate(world);
auto geom = dCreateBox(subspace, 1, 1, 1);
dMass m;
dMassSetBox(&m, 1, 1, 1, 1);
dGeomSetBody(geom, body);
dGeomSetOffsetPosition (geom, 0, 0, 0);
// Disable
dSpaceRemove(dGeomGetSpace((dGeomID)subspace), (dGeomID)subspace);
dSpaceAdd(world_space, (dGeomID)subspace);
// Enable
dSpaceRemove(dGeomGetSpace((dGeomID)subspace), (dGeomID)subspace);
dSpaceAdd(space, (dGeomID)subspace);
// Disable
dSpaceRemove(dGeomGetSpace((dGeomID)subspace), (dGeomID)subspace);
dSpaceAdd(world_space, (dGeomID)subspace);
}
> Like most of the application libraries, ODE requires initialization and finalization calls (which are missing from your source).
This means that you must call the library initialization function, at least, before starting calling other functions and creating objects from it.
Generally, it’s always a good idea to look through library public headers before starting writing code that uses it.
Oleh Derevenko
-- Skype with underscore
GPG Key Fingerprint: 2F56 32DC DCD9 B2BB 06E9 39E8 A37E 5E60 376E C691
From: ode-...@googlegroups.com <ode-...@googlegroups.com> On Behalf Of David Guillen Fandos
Sent: Tuesday, July 28, 2020 7:26 PM
To: ode-...@googlegroups.com
Subject: Re: Re: [ode-users] Bug in QuadTree space?
Hey there!
Well most examples only build an scenario and use it. In my case, this comes from an old game I did, I move objects between spaces to optimize the collision routines (so that objects that cannot touch each other are not tested for collision). I think what I'm doing is 100% valid and legit, removing an object and re-adding it back, but for some reason it fails.
--
You received this message because you are subscribed to a topic in the Google Groups "ode-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ode-users/MpSfjodUWEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ode-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ode-users/VI1PR0701MB684717C0162C5F5CCA0621A9DD730%40VI1PR0701MB6847.eurprd07.prod.outlook.com.
Thank you David, fixed it.
Please use the latest commits in “0.16.x” or “master”.
Oleh Derevenko
-- Skype with underscore
GPG Key Fingerprint: 2F56 32DC DCD9 B2BB 06E9 39E8 A37E 5E60 376E C691
From: ode-...@googlegroups.com <ode-...@googlegroups.com> On Behalf Of David Guillen Fandos
Sent: Tuesday, July 28, 2020 9:27 PM
To: ode-...@googlegroups.com
Subject: Re: Re: [ode-users] Bug in QuadTree space?
Hey there!
Ok so taking a look back in history, since I know my old code used to work well in an older version of ODE (back in 2012, version 0.11 or so IIRC).