0xc0dec
20-10-2010 19:43:05
Hi everyone!
I started to use OgreBullet not long ago. The library looks very nice, but recently a came across some very confusing "features" when tried to understand why I get "access violation" exception in my demo code.
The OgreBulletCollisions::CapsuleCollisionShape and OgreBulletCollisions::ConeCollisionShape class constructors have third parameter called "axe". Why "axe"? As I figured out during the process of fixing my weird exception, this parameter stands for capsule/cone rotation axis. I don't know any case when "axe" means "axis" . Maybe it would be better to rename this parameter to "axis" or "rotationAxis" to avoid such kind of confusion?
Moreover, the above constructors contain code like this:
In other cases the mShape remains equal to nullptr, causing "funny" exception when you try to pass some arbitrary vector, so as I did for the first time . I think it would be nice to use some special enum as the third parameter instead of Ogre::Vector3, if you consider only these three types of vectors. Or use default value for mShape, if none of these three vectors is the case. Or at least choose the maximum component of input vector and use it to determine the shape axis. But as for me, the first option is preferable, because it is more explicit then the other two.
Thanks.
UPDATE: Probably this request should have been posted in Ogre addons tracker, but I think the topic is a subject for discussion.
I started to use OgreBullet not long ago. The library looks very nice, but recently a came across some very confusing "features" when tried to understand why I get "access violation" exception in my demo code.
The OgreBulletCollisions::CapsuleCollisionShape and OgreBulletCollisions::ConeCollisionShape class constructors have third parameter called "axe". Why "axe"? As I figured out during the process of fixing my weird exception, this parameter stands for capsule/cone rotation axis. I don't know any case when "axe" means "axis" . Maybe it would be better to rename this parameter to "axis" or "rotationAxis" to avoid such kind of confusion?
Moreover, the above constructors contain code like this:
if (axe == Vector3::UNIT_X)
mShape = new btCapsuleShapeX(radius, height);
else if (axe == Vector3::UNIT_Y)
mShape = new btCapsuleShape (radius, height);
else if (axe == Vector3::UNIT_Z)
mShape = new btCapsuleShapeZ(radius, height);
In other cases the mShape remains equal to nullptr, causing "funny" exception when you try to pass some arbitrary vector, so as I did for the first time . I think it would be nice to use some special enum as the third parameter instead of Ogre::Vector3, if you consider only these three types of vectors. Or use default value for mShape, if none of these three vectors is the case. Or at least choose the maximum component of input vector and use it to determine the shape axis. But as for me, the first option is preferable, because it is more explicit then the other two.
Thanks.
UPDATE: Probably this request should have been posted in Ogre addons tracker, but I think the topic is a subject for discussion.