While working on my framework, I found two things that can be potentially dangerous:
The first one is not a bug, but it took me a while to trace the source of the continuous crashes when exiting the app:
On CcdPhysicsDemo, when you define this:
CcdConstructionInfo ccdObjectCi;
There's a parameter missing, that causes a crash if the CcdPhysicsController is called, the parameter is this one:
ccdObjectCi.m_physicsEnv = CurrentPhysicsEnvironmet;
The other problem is also in CcdPhysicsController destructor, the reason is that the destructor deletes the pointer to PHY_IMotionState* . Both in the CcdPhysicsDemo and my framework, the "myMotionState" objects are stored in the stack, not in the heap, so when the destructor of CcdPhysicsController is invoked, it causes a crash.
btw, which is the use of myMotionState?
CcdPhysicsController should not delete the PHY_IMotionState* pointer, since it's the user task to create the object, it is also the user task to destroy it.
Also, I noticed there are several structures in Bullet that require to be filled with correct parameters; I noticed that when filling some of them, there are parameters missing here and there, I figure you know what you're doing, but this can be prone to miss critical parameters, that are hard to trace. What I usually do is to add a "Reset" or "Clear" function that resets the structure values to its default, so I avoid missing to fill them correctly.
Hope it helps
Vic
bug on CcdPhysicsController destructor
-
- Posts: 21
- Joined: Thu Jun 01, 2006 9:55 pm
bug on CcdPhysicsController destructor
Last edited by vicviper on Fri Aug 11, 2006 10:01 pm, edited 1 time in total.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Every application needs to provide a derived class of PHY_IMotionState.btw, which is the use of myMotionState?
This synchronizes the physics and graphic transform. Typically you would derive your own version for your particular graphics transform class.
I will put the ownership of data / initialization on the TODO.
Thanks for the useful feedback.
Erwin