diff --git a/examples/SharedMemory/PhysicsClientC_API.cpp b/examples/SharedMemory/PhysicsClientC_API.cpp index abf228607..33ca652e1 100644 --- a/examples/SharedMemory/PhysicsClientC_API.cpp +++ b/examples/SharedMemory/PhysicsClientC_API.cpp @@ -1232,6 +1232,7 @@ int b3ResetDynamicInfoSetMass(b3SharedMemoryCommandHandle commandHandle, int bod { struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle; b3Assert(command->m_type == CMD_RESET_DYNAMIC_INFO); + b3Assert(mass > 0); command->m_resetDynamicInfoArgs.m_bodyUniqueId = bodyUniqueId; command->m_resetDynamicInfoArgs.m_linkIndex = linkIndex; command->m_resetDynamicInfoArgs.m_mass = mass; diff --git a/examples/pybullet/examples/reset_dynamic_info.py b/examples/pybullet/examples/reset_dynamic_info.py new file mode 100644 index 000000000..fc0f3cea1 --- /dev/null +++ b/examples/pybullet/examples/reset_dynamic_info.py @@ -0,0 +1,18 @@ +import pybullet as p +import time +import math + +p.connect(p.GUI) + +p.loadURDF(fileName="plane.urdf",baseOrientation=[0.25882,0,0,0.96593]) +p.loadURDF(fileName="cube.urdf",baseOrientation=[0.25882,0,0,0.96593],basePosition=[0,0,2]) +p.loadURDF(fileName="cube.urdf",baseOrientation=[0,0,0,1],basePosition=[0,0,4]) +p.resetDynamicInfo(bodyUniqueId=2,linkIndex=-1,mass=0.1) +#p.resetDynamicInfo(bodyUniqueId=2,linkIndex=-1,mass=100.0) +p.setGravity(0,0,-10) +p.setRealTimeSimulation(0) +t=0 +while 1: + t=t+1 + time.sleep(.01) + p.stepSimulation()