mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 05:40:05 +00:00
report localVisualFrame instead localInertialFrame
This commit is contained in:
parent
76dcf3a751
commit
e652696f52
@ -329,7 +329,7 @@ struct b3VisualShapeData
|
||||
int m_visualGeometryType;//box primitive, sphere primitive, triangle mesh
|
||||
double m_dimensions[3];//meaning depends on m_visualGeometryType
|
||||
char m_meshAssetFileName[VISUAL_SHAPE_MAX_PATH_LEN];
|
||||
double m_localInertiaFrame[7];//pos[3], orn[4]
|
||||
double m_localVisualFrame[7];//pos[3], orn[4]
|
||||
//todo: add more data if necessary (material color etc, although material can be in asset file .obj file)
|
||||
double m_rgbaColor[4];
|
||||
};
|
||||
|
@ -289,7 +289,14 @@ void convertURDFToVisualShape(const UrdfVisual* visual, const char* urdfPathPref
|
||||
visualShapeOut.m_dimensions[0] = visual->m_geometry.m_meshScale[0];
|
||||
visualShapeOut.m_dimensions[1] = visual->m_geometry.m_meshScale[1];
|
||||
visualShapeOut.m_dimensions[2] = visual->m_geometry.m_meshScale[2];
|
||||
|
||||
visualShapeOut.m_localVisualFrame[0] = visual->m_linkLocalFrame.getOrigin()[0];
|
||||
visualShapeOut.m_localVisualFrame[1] = visual->m_linkLocalFrame.getOrigin()[1];
|
||||
visualShapeOut.m_localVisualFrame[2] = visual->m_linkLocalFrame.getOrigin()[2];
|
||||
visualShapeOut.m_localVisualFrame[3] = visual->m_linkLocalFrame.getRotation()[0];
|
||||
visualShapeOut.m_localVisualFrame[4] = visual->m_linkLocalFrame.getRotation()[1];
|
||||
visualShapeOut.m_localVisualFrame[5] = visual->m_linkLocalFrame.getRotation()[2];
|
||||
visualShapeOut.m_localVisualFrame[6] = visual->m_linkLocalFrame.getRotation()[3];
|
||||
|
||||
int sl = strlen(fullPath);
|
||||
if (sl < (VISUAL_SHAPE_MAX_PATH_LEN-1))
|
||||
{
|
||||
@ -550,7 +557,7 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(int linkIndex, const
|
||||
|
||||
const UrdfLink* link = *linkPtr;
|
||||
|
||||
for (int v = 0; v < link->m_visualArray.size();v++)
|
||||
for (int v1 = 0; v1 < link->m_visualArray.size();v1++)
|
||||
{
|
||||
btAlignedObjectArray<MyTexture2> textures;
|
||||
btAlignedObjectArray<GLInstanceVertex> vertices;
|
||||
@ -558,7 +565,7 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(int linkIndex, const
|
||||
btTransform startTrans; startTrans.setIdentity();
|
||||
//int graphicsIndex = -1;
|
||||
|
||||
const UrdfVisual& vis = link->m_visualArray[v];
|
||||
const UrdfVisual& vis = link->m_visualArray[v1];
|
||||
btTransform childTrans = vis.m_linkLocalFrame;
|
||||
btHashString matName(vis.m_materialName.c_str());
|
||||
UrdfMaterial *const * matPtr = model.m_materials[matName];
|
||||
@ -586,13 +593,13 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(int linkIndex, const
|
||||
b3VisualShapeData visualShape;
|
||||
visualShape.m_objectUniqueId = bodyUniqueId;
|
||||
visualShape.m_linkIndex = linkIndex;
|
||||
visualShape.m_localInertiaFrame[0] = localInertiaFrame.getOrigin()[0];
|
||||
visualShape.m_localInertiaFrame[1] = localInertiaFrame.getOrigin()[1];
|
||||
visualShape.m_localInertiaFrame[2] = localInertiaFrame.getOrigin()[2];
|
||||
visualShape.m_localInertiaFrame[3] = localInertiaFrame.getRotation()[0];
|
||||
visualShape.m_localInertiaFrame[4] = localInertiaFrame.getRotation()[1];
|
||||
visualShape.m_localInertiaFrame[5] = localInertiaFrame.getRotation()[2];
|
||||
visualShape.m_localInertiaFrame[6] = localInertiaFrame.getRotation()[3];
|
||||
visualShape.m_localVisualFrame[0] = vis.m_linkLocalFrame.getOrigin()[0];
|
||||
visualShape.m_localVisualFrame[1] = vis.m_linkLocalFrame.getOrigin()[1];
|
||||
visualShape.m_localVisualFrame[2] = vis.m_linkLocalFrame.getOrigin()[2];
|
||||
visualShape.m_localVisualFrame[3] = vis.m_linkLocalFrame.getRotation()[0];
|
||||
visualShape.m_localVisualFrame[4] = vis.m_linkLocalFrame.getRotation()[1];
|
||||
visualShape.m_localVisualFrame[5] = vis.m_linkLocalFrame.getRotation()[2];
|
||||
visualShape.m_localVisualFrame[6] = vis.m_linkLocalFrame.getRotation()[3];
|
||||
visualShape.m_rgbaColor[0] = rgbaColor[0];
|
||||
visualShape.m_rgbaColor[1] = rgbaColor[1];
|
||||
visualShape.m_rgbaColor[2] = rgbaColor[2];
|
||||
|
@ -2931,24 +2931,24 @@ static PyObject* pybullet_getVisualShapeData(PyObject* self, PyObject* args, PyO
|
||||
|
||||
{
|
||||
PyObject* vec = PyTuple_New(3);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[0]);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[0]);
|
||||
PyTuple_SetItem(vec, 0, item);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[1]);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[1]);
|
||||
PyTuple_SetItem(vec, 1, item);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[2]);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[2]);
|
||||
PyTuple_SetItem(vec, 2, item);
|
||||
PyTuple_SetItem(visualShapeObList, 5, vec);
|
||||
}
|
||||
|
||||
{
|
||||
PyObject* vec = PyTuple_New(4);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[3]);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[3]);
|
||||
PyTuple_SetItem(vec, 0, item);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[4]);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[4]);
|
||||
PyTuple_SetItem(vec, 1, item);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[5]);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[5]);
|
||||
PyTuple_SetItem(vec, 2, item);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localInertiaFrame[6]);
|
||||
item = PyInt_FromLong(visualShapeInfo.m_visualShapeData[i].m_localVisualFrame[6]);
|
||||
PyTuple_SetItem(vec, 3, item);
|
||||
PyTuple_SetItem(visualShapeObList, 6, vec);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user