Skip to content

Commit

Permalink
fixed jolts in physics?
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineRichard committed Sep 10, 2024
1 parent 87203ed commit 30f0f52
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cfg/physics/default_physics.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
physics_scene:
dt: 0.16666
dt: 0.016666
gravity: [0.0, 0.0, -1.62]
enable_ccd: true
enable_stabilization: false
enable_stabilization: true
solver_type: PGS
use_gpu_pipeline: false
broadphase_type: SAP
6 changes: 6 additions & 0 deletions src/configurations/physics_confs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class PhysicsSceneConf:
gpu_max_num_partions: int = None
gpu_collision_stack_size: int = None
solver_type: str = None
broadphase_type: str = None
enable_stabilization: bool = None
bounce_threshold_velocity: float = None
friction_offset_threshold: float = None
Expand All @@ -41,3 +42,8 @@ def __post_init__(self):
for attribute in dataclasses.fields(self):
if getattr(self, attribute.name) is not None:
self.physics_scene_args[attribute.name] = getattr(self, attribute.name)

if self.broadphase_type is not None:
assert self.broadphase_type in ["SAP", "MBP", "GPU"]
if self.solver_type is not None:
assert self.solver_type in ["PGS", "TGS"]
6 changes: 5 additions & 1 deletion src/physics/physics_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
class PhysicsSceneManager:
def __init__(self, settings: PhysicsSceneConf) -> None:
self.settings = settings
self.physics_context = PhysicsContext(sim_params=self.settings.physics_scene_args)
self.physics_context = PhysicsContext(sim_params=self.settings.physics_scene_args, set_defaults=True)
if self.settings.enable_ccd:
self.physics_context.enable_ccd(True)
if self.settings.broadphase_type is not None:
self.physics_context.set_broadphase_type(self.settings.broadphase_type)
if self.settings.solver_type is not None:
self.physics_context.set_solver_type(self.settings.solver_type)

0 comments on commit 30f0f52

Please sign in to comment.