|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughI purchased this book to get my feet wet with basic sim/modeling. It uses Visual Studio C++ (2008), DirectX9, and ODE. I've ran into small problems, such as dInitODE() not being called in in the sample code and have managed to figure out most things I've encountered so far. I'm stuck on a Ground Plane that seems to be detecting collisions from objects falling on it, but the objects just keep on trucking right through it as if it wasn't there. I've poked around in the ODE doc and tried a few changes and changed Ground Plane parameters to match those in some of the ODE 'demos' with no joy. The book was put out in 2005 so I'm guessing that it was using an earlier version of ODE and I'm hoping there is a parameter I've missed that the 0.11.1 version may require that I haven't picked up on yet. I'd appreciate any ideas or a push in the right direction. I can include source files if needed, but I was hoping that this particular book title may have had other folks looking for similar answers. I poked oround in this oup and a few other places trying some of the things that seemed to help folks with similar problems (stuff falling though ground instead of bouncing off) but so far nothing has worked for me. I've been screwing with it long enough that I'm sure I can't see the cows for the trees (or something like that). I'd definitely appreciate any ideas that may help me unsscramble my head enogh to move on to my next challenge. Thanks, Steve Reynolds --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughrsreynolds wrote: > I'm stuck on a Ground Plane that seems to be detecting collisions from > objects falling on it, but the objects just keep on trucking right > through it as if it wasn't there. Some things to check, in this order: 1. Is the collision callback being called? 2. Does dCollide return any contact? 3. Are you creating the contact joints properly? Consider posting your code on pastebin.com and sending us the link so we can test it. > The book was put out in 2005 so I'm guessing that it was using an > earlier version of ODE and I'm hoping there is a parameter I've missed > that the 0.11.1 version may require that I haven't picked up on yet. Other than library initialization, everything should still work the same as in 0.5 (for your simple test case, that is). -- Daniel K. O. "The only way to succeed is to build success yourself" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling through> I'm stuck on a Ground Plane that seems to be detecting collisions from > objects falling on it, but the objects just keep on trucking right > through it as if it wasn't there. I take "seems to be detecting collisions" to mean that dCollide() is generating contacts between the plane and the objects. Some things to check: - Are you creating contact joints from those contacts with dJointCreateContact()? - Are you attaching those joints to the objects and the static environment with dJointAttach()? - Are you setting the contact surface parameters (especially surface.mode) before calling dJointCreateContact() ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughThanks for the info. I'll definitely check the areas suggested. The last "- Are you setting the contact surface parameters (especially surface.mode) before calling dJointCreateContact() ? " may be culprit as I don't remember anything about surface mode. Will check it out and respond with results and post source files to pastebin.com and provide link. Thanks guys, Steve Reynolds On Nov 3, 8:31 am, wb4 <wbrame...@...> wrote: > > I'm stuck on a Ground Plane that seems to be detecting collisions from > > objects falling on it, but the objects just keep on trucking right > > through it as if it wasn't there. > > I take "seems to be detecting collisions" to mean that dCollide() is > generating contacts between the plane and the objects. Some things to > check: > - Are you creating contact joints from those contacts with > dJointCreateContact()? > - Are you attaching those joints to the objects and the static > environment with dJointAttach()? > - Are you setting the contact surface parameters (especially > surface.mode) before calling dJointCreateContact() ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughI believe this is section of code that your asking about: ... dContact contact[CWorld::MAX_CONTACTS]; for (i=0; i<CWorld::MAX_CONTACTS; i++) { contact[i].surface.mode = dContactBounce | dContactSoftCFM; contact[i].surface.mu = dInfinity; contact[i].surface.mu2 = 0; contact[i].surface.bounce = 1.5; contact[i].surface.bounce_vel = 1.6; contact[i].surface.soft_cfm = 0.01; } if (int numc = dCollide (o1, o2, CWorld::MAX_CONTACTS, &contact [0].geom, sizeof(dContact))) { for (i=0; i<numc; i++) { dJointID c = dJointCreateContact ( GetWorld()->GetWorldID(), GetWorld()->GetJointGroupID(), &contact[i]); dJointAttach (c,b1,b2); } } ... wb4 wrote: > > I'm stuck on a Ground Plane that seems to be detecting collisions from > > objects falling on it, but the objects just keep on trucking right > > through it as if it wasn't there. > > I take "seems to be detecting collisions" to mean that dCollide() is > generating contacts between the plane and the objects. Some things to > check: > - Are you creating contact joints from those contacts with > dJointCreateContact()? > - Are you attaching those joints to the objects and the static > environment with dJointAttach()? > - Are you setting the contact surface parameters (especially > surface.mode) before calling dJointCreateContact() ? You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughOn Nov 4, 2:07 pm, rsreynolds <skypigtw...@...> wrote: > I believe this is section of code that your asking about: > > ... > dContact contact[CWorld::MAX_CONTACTS]; > for (i=0; i<CWorld::MAX_CONTACTS; i++) > { > contact[i].surface.mode = dContactBounce | dContactSoftCFM; > contact[i].surface.mu = dInfinity; > contact[i].surface.mu2 = 0; > contact[i].surface.bounce = 1.5; > contact[i].surface.bounce_vel = 1.6; > contact[i].surface.soft_cfm = 0.01; > } > if (int numc = dCollide (o1, o2, CWorld::MAX_CONTACTS, &contact > [0].geom, sizeof(dContact))) > { > for (i=0; i<numc; i++) > { > dJointID c = dJointCreateContact ( GetWorld()->GetWorldID(), > GetWorld()->GetJointGroupID(), > &contact[i]); > dJointAttach (c,b1,b2); > } > } > ... Yes, and it looks okay to me, assuming that b1 and b2 are being set properly before dJointAttach() is called. Can you verify that numc > 0 when your objects intersect the plane? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughNumc is 1 at collision. Full NearCallback() below: // NearCallback(...) // this is called by dSpaceCollide when two objects in space are // potentially colliding. This function was taken from the ODE library // examples. ////////////////////////////////////////////////////////////////////// static void NearCallback (void *data, dGeomID o1, dGeomID o2) { int i; // exit without doing anything if the two bodies are connected by a joint dBodyID b1 = dGeomGetBody(o1); dBodyID b2 = dGeomGetBody(o2); if (b1 && b2 && dAreConnectedExcluding (b1, b2, dJointTypeContact)) return; dContact contact[CWorld::MAX_CONTACTS]; for (i=0; i<CWorld::MAX_CONTACTS; i++) { contact[i].surface.mode = dContactBounce | dContactSoftCFM; contact[i].surface.mu = dInfinity; contact[i].surface.mu2 = 0; contact[i].surface.bounce = 1.5; contact[i].surface.bounce_vel = 1.6; contact[i].surface.soft_cfm = 0.01; } if (int numc = dCollide (o1, o2, CWorld::MAX_CONTACTS, &contact [0].geom, sizeof(dContact))) { for (i=0; i<numc; i++) { dJointID c = dJointCreateContact ( GetWorld()->GetWorldID(), GetWorld()->GetJointGroupID(), &contact[i]); dJointAttach (c,b1,b2); } } } If we don't get it sorted out in the next few days I'll post VS2008 solution/source/libs/includes and anything else I think it needs to be built at pastebin.com and provide link. rsreynolds > > Yes, and it looks okay to me, assuming that b1 and b2 are being set > properly before dJointAttach() is called. > > Can you verify that numc > 0 when your objects intersect the plane? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughAs an after-thought, I figured I'd throw in the code where the ground plane is created - maybe something is hosed there... ... // Create the ground plane CEntity *pGround = GetWorld()->CreateEntity(L"Ground", 5, .2, 5, D3DCOLOR_XRGB(128,128,255), m_pGraphics->GetDevice()); // Prevent the ground from falling pGround->SetEnabled(false); // To make the ground fall when the first ball hits it, //uncomment this code: // pGround->SetEnabled(true); // pGround->SetGravity(false); ... On Nov 4, 9:42 pm, rsreynolds <skypigtw...@...> wrote: > Numc is 1 at collision. Full NearCallback() below: > > // NearCallback(...) > // this is called by dSpaceCollide when two objects in space are > // potentially colliding. This function was taken from the ODE library > // examples. > ////////////////////////////////////////////////////////////////////// > static void NearCallback (void *data, dGeomID o1, dGeomID o2) > { > int i; > > // exit without doing anything if the two bodies are connected by a > joint > dBodyID b1 = dGeomGetBody(o1); > dBodyID b2 = dGeomGetBody(o2); > if (b1 && b2 && > dAreConnectedExcluding (b1, b2, dJointTypeContact)) return; > > dContact contact[CWorld::MAX_CONTACTS]; > for (i=0; i<CWorld::MAX_CONTACTS; i++) > { > contact[i].surface.mode = dContactBounce | dContactSoftCFM; > contact[i].surface.mu = dInfinity; > contact[i].surface.mu2 = 0; > contact[i].surface.bounce = 1.5; > contact[i].surface.bounce_vel = 1.6; > contact[i].surface.soft_cfm = 0.01; > } > if (int numc = dCollide (o1, o2, CWorld::MAX_CONTACTS, &contact > [0].geom, sizeof(dContact))) > { > for (i=0; i<numc; i++) > { > dJointID c = dJointCreateContact ( GetWorld()->GetWorldID(), > GetWorld()->GetJointGroupID(), > &contact[i]); > dJointAttach (c,b1,b2); > } > } > > } > > If we don't get it sorted out in the next few days I'll post VS2008 > solution/source/libs/includes and anything else I think it needs to be > built at pastebin.com and provide link. > > rsreynolds > > > > > Yes, and it looks okay to me, assuming that b1 and b2 are being set > > properly before dJointAttach() is called. > > > Can you verify that numc > 0 when your objects intersect the plane? You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughrsreynolds wrote: > contact[i].surface.mode = dContactBounce | dContactSoftCFM; > contact[i].surface.mu = dInfinity; > contact[i].surface.mu2 = 0; > contact[i].surface.bounce = 1.5; > contact[i].surface.bounce_vel = 1.6; > contact[i].surface.soft_cfm = 0.01; > A bounce restitution of 1.5 will add energy to the system. Try something much smaller, like 0.1, to begin with. A CFM of 0.01 is really high, and will make the system very squishy. For a very heavy ball, the system may actually not be able to push it out. A mu of "dInfinity" might be too much for some of the internal math; I don't know. The problem is that, if you don't turn on dContactApprox1, "mu" is a force limit, not a coefficient of friction. I would turn on dContactApprox1, and set mu and mu2 to some high cof, like 2.0 or so, to start with. On a general code cleanliness topic: It would be more efficient to move this assignment into the loop where you actually create the contact joint, so you only do the assignments for dContacts you will actually use. The dCollide function doesn't use those fields at all. Sincerely, jw -- Revenge is the most pointless and damaging of human desires. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game Development (Thomson Course Technology) and ODE Ground Plane not stopping objects from falling throughThanks for info Jon. Made suggested changes and played with values a little but still get no bounce. rsreynolds On Nov 5, 11:31 am, Jon Watte <jwa...@...> wrote: > rsreynolds wrote: > > contact[i].surface.mode = dContactBounce | dContactSoftCFM; > > contact[i].surface.mu = dInfinity; > > contact[i].surface.mu2 = 0; > > contact[i].surface.bounce = 1.5; > > contact[i].surface.bounce_vel = 1.6; > > contact[i].surface.soft_cfm = 0.01; > > A bounce restitution of 1.5 will add energy to the system. Try something > much smaller, like 0.1, to begin with. > A CFM of 0.01 is really high, and will make the system very squishy. For > a very heavy ball, the system may actually not be able to push it out. > A mu of "dInfinity" might be too much for some of the internal math; I > don't know. The problem is that, if you don't turn on dContactApprox1, > "mu" is a force limit, not a coefficient of friction. I would turn on > dContactApprox1, and set mu and mu2 to some high cof, like 2.0 or so, to > start with. > > On a general code cleanliness topic: It would be more efficient to move > this assignment into the loop where you actually create the contact > joint, so you only do the assignments for dContacts you will actually > use. The dCollide function doesn't use those fields at all. > > Sincerely, > > jw > > -- > > Revenge is the most pointless and damaging of human desires. You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game DevelopmentIn my experience 'bounce' often doesn't give you the results you expect. I think it interacts with the chosen CFM and ERP of the contacts (and if these generate a relatively large amount of damping then you will lose energy from the system and you won't get much if any bouncing - similarly you can get bouncing with a bounce of zero if the contact is soft since you get quite a bit of energy store and recovery from the penetration). Try using the default values for CFM and ERP which are very stiff with very little damping (think dropping a pool ball onto a slate table - it still bounces). Cheers Bill On 6 Nov 2009, at 01:02, rsreynolds wrote: > > Thanks for info Jon. Made suggested changes and played with values a > little but still get no bounce. > > rsreynolds > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game DevelopmentFull source code and VS2008 config is not going to be easy to post. Link to the publisher's site where code can be downloaded is: http://www.courseptr.com/ptr_downloads.cfm?searchTerm=simulation+and+event+modeling+for+game+developers&submit=Search+Downloads Chapter 8, section 2 is where I encountered the ground plane not stopping items dropped on it. If anyone wants to take a look, the things I encountered and had to fix were a problem with with deleting vector iterators and still trying to use them. I think the fix was something like "i = m_lstEvents.erase(i); vice "m_lstEvents.erase (i);". Also had to add dInitODE(): to main.cpp. I'm thinking it has to be in how the tutorial application is setting up the Ground Plane, but ain't having much luck figuring out why entities fall though after collision. rsr On Nov 6, 2:40 am, Bill Sellers <w...@...> wrote: > In my experience 'bounce' often doesn't give you the results you > expect. I think it interacts with the chosen CFM and ERP of the > contacts (and if these generate a relatively large amount of damping > then you will lose energy from the system and you won't get much if > any bouncing - similarly you can get bouncing with a bounce of zero if > the contact is soft since you get quite a bit of energy store and > recovery from the penetration). Try using the default values for CFM > and ERP which are very stiff with very little damping (think dropping > a pool ball onto a slate table - it still bounces). > > Cheers > Bill > > On 6 Nov 2009, at 01:02, rsreynolds wrote: > > > > > Thanks for info Jon. Made suggested changes and played with values a > > little but still get no bounce. > > > rsreynolds You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game DevelopmentI had the same problem. Here is what was wrong : dSpaceCollide (space,0,&nearCallback); if (!pause)dWorldQuickStep (world,0.02); This is the order in which these 2 function calls should appear. I had the order reversed and that was making the objects fall through the ground. Im not sure if this would fix your problem, but its definitely one of the causes. --Neeti On Nov 6, 7:13 pm, rsreynolds <skypigtw...@...> wrote: > Full source code and VS2008 config is not going to be easy to post. > Link to the publisher's site where code can be downloaded is:http://www.courseptr.com/ptr_downloads.cfm?searchTerm=simulation+and+... > > Chapter 8, section 2 is where I encountered thegroundplane not > stopping items dropped on it. If anyone wants to take a look, the > things I encountered and had to fix were a problem with with deleting > vector iterators and still trying to use them. I think the fix was > something like "i = m_lstEvents.erase(i); vice "m_lstEvents.erase > (i);". Also had to add dInitODE(): to main.cpp. I'm thinking it has to > be in how the tutorial application is setting up theGroundPlane, but > ain't having much luck figuring out why entities fall though after > collision. > > rsr > > On Nov 6, 2:40 am, Bill Sellers <w...@...> wrote: > > > In my experience 'bounce' often doesn't give you the results you > > expect. I think it interacts with the chosen CFM and ERP of the > > contacts (and if these generate a relatively large amount of damping > > then you will lose energy from the system and you won't get much if > > any bouncing - similarly you can get bouncing with a bounce of zero if > > the contact is soft since you get quite a bit of energy store and > > recovery from the penetration). Try using the default values for CFM > > and ERP which are very stiff with very little damping (think dropping > > a pool ball onto a slate table - it still bounces). > > > Cheers > > Bill > > > On 6 Nov 2009, at 01:02, rsreynolds wrote: > > > > Thanks for info Jon. Made suggested changes and played with values a > > > little but still get no bounce. > > > > rsreynolds > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@... To unsubscribe from this group, send email to ode-users+unsubscribe@... For more options, visit this group at http://groups.google.com/group/ode-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Simulation and Event Modeling For Game DevelopmentThank you very much!
On Nov 16, 3:36 am, Neeti Wagle <neetiwa...@...> wrote: > I had the same problem. Here is what was wrong : > > dSpaceCollide (space,0,&nearCallback); > if (!pause)dWorldQuickStep (world,0.02); > > This is the order in which these 2 function calls should appear. I had > the order reversed and that was making the objects fall through the > ground. > > Im not sure if this would fix your problem, but its definitely one of > the causes. > > --Neeti > > On Nov 6, 7:13 pm, rsreynolds <skypigtw...@...> wrote: > > > Full source code and VS2008 config is not going to be easy to post. > > Link to the publisher's site where code can be downloaded is:http://www.courseptr.com/ptr_downloads.cfm?searchTerm=simulation+and+... > > > Chapter 8, section 2 is where I encountered thegroundplane not > > stopping items dropped on it. If anyone wants to take a look, the > > things I encountered and had to fix were a problem with with deleting > > vector iterators and still trying to use them. I think the fix was > > something like "i = m_lstEvents.erase(i); vice "m_lstEvents.erase > > (i);". Also had to add dInitODE(): to main.cpp. I'm thinking it has to > > be in how the tutorial application is setting up theGroundPlane, but > > ain't having much luck figuring out why entities fall though after > > collision. > > > rsr > > > On Nov 6, 2:40 am, Bill Sellers <w...@...> wrote: > > > > In my experience 'bounce' often doesn't give you the results you > > > expect. I think it interacts with the chosen CFM and ERP of the > > > contacts (and if these generate a relatively large amount of damping > > > then you will lose energy from the system and you won't get much if > > > any bouncing - similarly you can get bouncing with a bounce of zero if > > > the contact is soft since you get quite a bit of energy store and > > > recovery from the penetration). Try using the default values for CFM > > > and ERP which are very stiff with very little damping (think dropping > > > a pool ball onto a slate table - it still bounces). > > > > Cheers > > > Bill > > > > On 6 Nov 2009, at 01:02, rsreynolds wrote: > > > > > Thanks for info Jon. Made suggested changes and played with values a > > > > little but still get no bounce. > > > > > rsreynolds -- You received this message because you are subscribed to the Google Groups "ode-users" group. To post to this group, send email to ode-users@.... To unsubscribe from this group, send email to ode-users+unsubscribe@.... For more options, visit this group at http://groups.google.com/group/ode-users?hl=. |
| Free embeddable forum powered by Nabble | Forum Help |