litghost
16-09-2007 00:56:42
In demo 3, you create conveyor belts with the following code:
This seems okay, but you store the collision pointer in OgreNewt::Body, and it can be retrieved later via the getCollision. While you never use the collision pointer after the constructor or the get within the OgreNewt::Body class, is it really a good idea to have OgreNewt::Body have a pointer to a deleted object? Did you mean for OgreNewt::Body to has a copy of the collision pointer? Why doesn't OgreNewt::Body handle the collision pointer?
// create the collision object for the conveyor belt.
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Box( world, size );
mBody = new OgreNewt::Body( world, col, conveyorType );
delete col;
This seems okay, but you store the collision pointer in OgreNewt::Body, and it can be retrieved later via the getCollision. While you never use the collision pointer after the constructor or the get within the OgreNewt::Body class, is it really a good idea to have OgreNewt::Body have a pointer to a deleted object? Did you mean for OgreNewt::Body to has a copy of the collision pointer? Why doesn't OgreNewt::Body handle the collision pointer?