kubric
kubric copied to clipboard
WIP: add a force option to pybullet
This was a draft for adding custom forces during the simulation. Can be used like this:
random_forces = {
obj.linked_objects[simulator]: {
20*i+rng.randint(1, 20): (rng.uniform(*velocity_range), 0.2)
for i in range(25)}
for obj in scene.foreground_assets
}
animation, collisions = simulator.run(frame_start=0, frame_end=scene.frame_end+1, forces=random_forces)
The design is not ideal, because it requires listing the forces beforehand, so they cannot depend on dynamic state of the objects. Maybe a callback would be better.