Merge pull request #1149 from erwincoumans/master

use a fixed joint instead of crashing for unsupported joint types (pl…
This commit is contained in:
erwincoumans
2017-05-25 14:57:45 -07:00
committed by GitHub
4 changed files with 24 additions and 0 deletions

View File

@@ -362,8 +362,14 @@ void ConvertURDF2BulletInternal(
switch (jointType)
{
case URDFFloatingJoint:
case URDFPlanarJoint:
case URDFFixedJoint:
{
if ((jointType==URDFFloatingJoint)||(jointType==URDFPlanarJoint))
{
printf("Warning: joint unsupported, creating a fixed joint instead.");
}
if (createMultiBody)
{
//todo: adjust the center of mass transform and pivot axis properly

View File

@@ -421,3 +421,13 @@ float SimpleCamera::getCameraFrustumNear() const
{
return m_data->m_frustumZNear;
}
void SimpleCamera::setCameraFrustumFar(float far)
{
m_data->m_frustumZFar = far;
}
void SimpleCamera::setCameraFrustumNear(float near)
{
m_data->m_frustumZNear = near;
}

View File

@@ -54,6 +54,9 @@ struct SimpleCamera : public CommonCameraInterface
virtual float getCameraFrustumFar() const;
virtual float getCameraFrustumNear() const;
virtual void setCameraFrustumFar(float far);
virtual void setCameraFrustumNear(float near);
};
#endif //SIMPLE_CAMERA_H

View File

@@ -726,7 +726,12 @@ void TinyRendererVisualShapeConverter::render(const float viewMat[16], const flo
clearColor.bgra[3] = 255;
clearBuffers(clearColor);
float near = projMat[14]/(projMat[10]-1);
float far = projMat[14]/(projMat[10]+1);
m_data->m_camera.setCameraFrustumNear( near);
m_data->m_camera.setCameraFrustumFar(far);
ATTRIBUTE_ALIGNED16(btScalar modelMat[16]);