diff --git a/src/body.cpp b/src/body.cpp index 5af100f024..21f16e46c8 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -1507,13 +1507,17 @@ DynamicBody::saveToXml(QTextStream &xml) { void DynamicBody::setCoG(const position &newCoG) { - CoG = newCoG; + CoG = newCoG; resetDynamics(); - //use this to display axes at the CoG - //axesTranToCOG->translation.setValue(CoG.x(), CoG.y(), CoG.z()); - //use this to display axes at body origin - axesTranToCOG->translation.setValue(0, 0, 0); + if (graspitCore && axesTranToCOG) + { + //use this to display axes at the CoG + //axesTranToCOG->translation.setValue(CoG.x(), CoG.y(), CoG.z()); + + //use this to display axes at body origin + axesTranToCOG->translation.setValue(0, 0, 0); + } } /*! The max radius can be thought of as the largest distance from the center @@ -1523,7 +1527,10 @@ void DynamicBody::setMaxRadius(double maxRad) { maxRadius = maxRad; - axesScale->scaleFactor = SbVec3f(maxRadius / AXES_SCALE, maxRadius / AXES_SCALE, maxRadius / AXES_SCALE); + if (graspitCore && axesScale) + { + axesScale->scaleFactor = SbVec3f(maxRadius / AXES_SCALE, maxRadius / AXES_SCALE, maxRadius / AXES_SCALE); + } } void