kubric icon indicating copy to clipboard operation
kubric copied to clipboard

WIP: add a force option to pybullet

Open Qwlouse opened this issue 3 years ago • 0 comments

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.

Qwlouse avatar Jul 21 '22 15:07 Qwlouse