diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index dde6ccebd..663d1f64a 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -13109,17 +13109,16 @@ bool PhysicsServerCommandProcessor::processUpdateVisualShapeCommand(const struct if (m_data->m_pluginManager.getRenderInterface()) { m_data->m_pluginManager.getRenderInterface()->changeShapeTexture(clientCmd.m_updateVisualShapeDataArguments.m_bodyUniqueId, - clientCmd.m_updateVisualShapeDataArguments.m_jointIndex, - clientCmd.m_updateVisualShapeDataArguments.m_shapeIndex, - texHandle->m_tinyRendererTextureId); + clientCmd.m_updateVisualShapeDataArguments.m_jointIndex, + clientCmd.m_updateVisualShapeDataArguments.m_shapeIndex, + texHandle->m_tinyRendererTextureId); } } else { m_data->m_pluginManager.getRenderInterface()->changeShapeTexture(clientCmd.m_updateVisualShapeDataArguments.m_bodyUniqueId, - clientCmd.m_updateVisualShapeDataArguments.m_jointIndex, - clientCmd.m_updateVisualShapeDataArguments.m_shapeIndex, - -1); + clientCmd.m_updateVisualShapeDataArguments.m_jointIndex, + clientCmd.m_updateVisualShapeDataArguments.m_shapeIndex,-1); } } } @@ -13233,14 +13232,27 @@ bool PhysicsServerCommandProcessor::processUpdateVisualShapeCommand(const struct else if (bodyHandle->m_softBody) { + int graphicsIndex = bodyHandle->m_softBody->getUserIndex(); + if (clientCmd.m_updateFlags & CMD_UPDATE_VISUAL_SHAPE_TEXTURE) + { + int shapeIndex = m_data->m_guiHelper->getShapeIndexFromInstance(graphicsIndex); + if (texHandle) + { + m_data->m_guiHelper->replaceTexture(shapeIndex, texHandle->m_openglTextureId); + } + else + { + m_data->m_guiHelper->replaceTexture(shapeIndex, -1); + } + } + if (clientCmd.m_updateFlags & CMD_UPDATE_VISUAL_SHAPE_RGBA_COLOR) { if (m_data->m_pluginManager.getRenderInterface()) { m_data->m_pluginManager.getRenderInterface()->changeRGBAColor(bodyUniqueId, linkIndex, - clientCmd.m_updateVisualShapeDataArguments.m_shapeIndex, clientCmd.m_updateVisualShapeDataArguments.m_rgbaColor); + clientCmd.m_updateVisualShapeDataArguments.m_shapeIndex, clientCmd.m_updateVisualShapeDataArguments.m_rgbaColor); } - int graphicsIndex = bodyHandle->m_softBody->getUserIndex(); m_data->m_guiHelper->changeRGBAColor(graphicsIndex, clientCmd.m_updateVisualShapeDataArguments.m_rgbaColor); } @@ -13252,7 +13264,6 @@ bool PhysicsServerCommandProcessor::processUpdateVisualShapeCommand(const struct clientCmd.m_updateVisualShapeDataArguments.m_shapeIndex, clientCmd.m_updateVisualShapeDataArguments.m_flags); } - int graphicsIndex = bodyHandle->m_softBody->getUserIndex(); m_data->m_guiHelper->changeInstanceFlags(graphicsIndex, clientCmd.m_updateVisualShapeDataArguments.m_flags); } diff --git a/examples/pybullet/examples/deformable_torus.py b/examples/pybullet/examples/deformable_torus.py index 30a736a70..39e0839fa 100644 --- a/examples/pybullet/examples/deformable_torus.py +++ b/examples/pybullet/examples/deformable_torus.py @@ -10,7 +10,7 @@ p.resetSimulation(p.RESET_USE_DEFORMABLE_WORLD) p.resetDebugVisualizerCamera(3,-420,-30,[0.3,0.9,-2]) p.setGravity(0, 0, -10) -tex = p.loadTexture("checker_blue.png") +tex = p.loadTexture("uvmap.png") planeId = p.loadURDF("plane.urdf", [0,0,-2]) boxId = p.loadURDF("cube.urdf", [0,3,2],useMaximalCoordinates = True)