more btCapsuleShape fixes

use hello_mjcf.xml for MJCF importer
This commit is contained in:
Erwin Coumans
2017-01-23 22:22:02 -08:00
parent a25a5e523c
commit 1b2db1ff09
4 changed files with 9 additions and 8 deletions

View File

@@ -123,7 +123,7 @@ ImportMJCFSetup::ImportMJCFSetup(struct GUIHelperInterface* helper, int option,
gMCFJFileNameArray.push_back("mjcf/humanoid.xml");
gMCFJFileNameArray.push_back("mjcf/inverted_pendulum.xml");
gMCFJFileNameArray.push_back("mjcf/ant.xml");
gMCFJFileNameArray.push_back("mjcf/hello_mjcf2.xml");
gMCFJFileNameArray.push_back("mjcf/hello_mjcf.xml");
gMCFJFileNameArray.push_back("mjcf/capsule.xml");
// gMCFJFileNameArray.push_back("mjcf/hopper.xml");
// gMCFJFileNameArray.push_back("mjcf/swimmer.xml");

View File

@@ -16,7 +16,6 @@ subject to the following restrictions:
#include "btCapsuleShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape ()
@@ -49,8 +48,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter
btVector3 vtx;
btScalar newDot;
btScalar radius = getRadius();
{
btVector3 pos(0,0,0);
@@ -85,8 +83,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter
{
btScalar radius = getRadius();
for (int j=0;j<numVectors;j++)
{
btScalar maxDot(btScalar(-BT_LARGE_FLOAT));

View File

@@ -86,7 +86,12 @@ public:
virtual void setLocalScaling(const btVector3& scaling)
{
btConvexInternalShape::setLocalScaling(scaling);
btVector3 unScaledImplicitShapeDimensions = m_implicitShapeDimensions / m_localScaling;
btConvexInternalShape::setLocalScaling(scaling);
m_implicitShapeDimensions = (unScaledImplicitShapeDimensions * scaling);
//update m_collisionMargin, since entire radius==margin
int radiusAxis = (m_upAxis+2)%3;
m_collisionMargin = m_implicitShapeDimensions[radiusAxis];
}
virtual btVector3 getAnisotropicRollingFrictionDirection() const

View File

@@ -230,7 +230,6 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV
btScalar halfHeight = capsuleShape->getHalfHeight();
int capsuleUpAxis = capsuleShape->getUpAxis();
btScalar radius = capsuleShape->getRadius();
btVector3 supVec(0,0,0);
btScalar maxDot(btScalar(-BT_LARGE_FLOAT));