-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
In the functions Model::addCylinder(...) and Model::addCapsule take the direction of the axis of the cylinder. We pass this direction to dMassSetCylinderTotal. We then set the cylinder's attitude depending on the orientation. This means we first set the orientation of the mass correct and then turned it to be wrong.
boost::shared_ptr<SimpleBody> Model::addCylinder(float mass,
const osg::Vec3& pos, int direction, float radius, float height,
int label) {
dMass massOde;
dMassSetCylinderTotal(&massOde, mass, direction, radius, height);
dxGeom* g = dCreateCylinder(this->getCollisionSpace(), radius, height);
osg::Quat rotateCylinder;
if (direction == 1) {
rotateCylinder.makeRotate(osg::inDegrees(90.0), osg::Vec3(0, 1, 0));
} else if (direction == 2) {
rotateCylinder.makeRotate(osg::inDegrees(90.0), osg::Vec3(1, 0, 0));
}
boost::shared_ptr<SimpleBody> body(new SimpleBody(shared_from_this(),
massOde, g, pos, rotateCylinder));
this->addBody(body, label);
return body;
Reactions are currently unavailable