Download physworld_p1_20261018/patch_ground.py from AIGeeksGroup/PhysicalWM: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/datasets/AIGeeksGroup/PhysicalWM/resolve/main/physworld_p1_20261018/patch_ground.py
- Command line
-
hf download hf://datasets/AIGeeksGroup/PhysicalWM/physworld_p1_20261018/patch_ground.py
-
curl -L -o patch_ground.py https://huggingface.co/datasets/AIGeeksGroup/PhysicalWM/resolve/main/physworld_p1_20261018/patch_ground.py
1.21 kB
| # -*- coding: utf-8 -*- | |
| import io | |
| p = "scripts/glb_to_sim_v2.py" | |
| s = io.open(p, encoding="utf-8").read() | |
| if "GROUND_FRICTION" not in s: | |
| s = s.replace( | |
| "FRICTION = 0.55\nRESTITUTION = 0.15", | |
| "FRICTION = 0.55\nRESTITUTION = 0.15\n" | |
| "# 地面参数设为 1.0:Bullet 对接触双方的摩擦/恢复系数取乘积,\n" | |
| "# 地面默认 0.5/0.0 会把物体参数悄悄减半、并让恢复系数恒为 0。\n" | |
| "GROUND_FRICTION = 1.0\nGROUND_RESTITUTION = 1.0", 1) | |
| old = (" ground_body = p.createMultiBody(baseMass=0, baseCollisionShapeIndex=ground,\n" | |
| " basePosition=center)\n") | |
| new = (" ground_body = p.createMultiBody(baseMass=0, baseCollisionShapeIndex=ground,\n" | |
| " basePosition=center)\n" | |
| " p.changeDynamics(ground_body, -1, lateralFriction=GROUND_FRICTION,\n" | |
| " restitution=GROUND_RESTITUTION)\n") | |
| assert old in s, "ground creation block not found" | |
| if "changeDynamics(ground_body" not in s: | |
| s = s.replace(old, new, 1) | |
| io.open(p, "w", encoding="utf-8").write(s) | |
| print("patched glb_to_sim_v2: ground =", "GROUND_FRICTION" in s) | |