Skip to content

Commit

Permalink
fix add_ground visual
Browse files Browse the repository at this point in the history
  • Loading branch information
fbxiang committed Nov 1, 2023
1 parent e6b65b3 commit 5cdd887
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
11 changes: 11 additions & 0 deletions python/py_package/utils/viewer/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,14 @@ def control_window(self) -> ControlWindow:
if isinstance(plugin, ControlWindow):
return plugin
return None

def loop(self, physx_steps=0):
"""
A convenience method for opening a temporary viewer for a scene.
Simply call scene.create_viewer().loop()
"""
while not self.closed:
for _ in range(physx_steps):
self.scene.physx_system.step()
self.scene.update_render()
self.render()
19 changes: 9 additions & 10 deletions python/py_package/wrapper/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,21 @@ def add_ground(
):
from .actor_builder import ActorBuilder

ground = (
ActorBuilder()
.set_scene(self)
.add_plane_visual(
builder = self.create_actor_builder()
if render:
builder.add_plane_visual(
sapien.Pose(p=[0, 0, altitude], q=[0.7071068, 0, -0.7071068, 0]),
[10, *render_half_size],
render_material,
"",
)
.add_plane_collision(
sapien.Pose(p=[0, 0, altitude], q=[0.7071068, 0, -0.7071068, 0]),
material,
)
.set_physx_body_type("static")
.build()

builder.add_plane_collision(
sapien.Pose(p=[0, 0, altitude], q=[0.7071068, 0, -0.7071068, 0]),
material,
)
builder.set_physx_body_type("static")
ground = builder.build()
ground.name = "ground"
return ground

Expand Down

0 comments on commit 5cdd887

Please sign in to comment.