PyBullet: allow to replace existing debug lines in addUserDebugLine through the replaceItemUniqueId argument

See batchRayCast.py for example usage
This commit is contained in:
erwincoumans
2018-06-22 16:47:20 -07:00
parent 6b2cae1b1d
commit 49b0ec08e1
7 changed files with 66 additions and 19 deletions

View File

@@ -4582,13 +4582,21 @@ bool PhysicsServerCommandProcessor::processUserDebugDrawCommand(const struct Sha
if (clientCmd.m_updateFlags & USER_DEBUG_HAS_LINE)
{
int replaceItemUid = -1;
if (clientCmd.m_updateFlags&USER_DEBUG_HAS_REPLACE_ITEM_UNIQUE_ID)
{
replaceItemUid = clientCmd.m_userDebugDrawArgs.m_replaceItemUniqueId;
}
int uid = m_data->m_guiHelper->addUserDebugLine(
clientCmd.m_userDebugDrawArgs.m_debugLineFromXYZ,
clientCmd.m_userDebugDrawArgs.m_debugLineToXYZ,
clientCmd.m_userDebugDrawArgs.m_debugLineColorRGB,
clientCmd.m_userDebugDrawArgs.m_lineWidth,
clientCmd.m_userDebugDrawArgs.m_lifeTime,
trackingVisualShapeIndex);
trackingVisualShapeIndex,
replaceItemUid
);
if (uid>=0)
{