-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathpbd_cloth.py
More file actions
66 lines (56 loc) · 1.62 KB
/
pbd_cloth.py
File metadata and controls
66 lines (56 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
import genesis as gs
########################## init ##########################
gs.init()
########################## create a scene ##########################
scene = gs.Scene(
sim_options=gs.options.SimOptions(
dt=4e-3,
substeps=10,
),
viewer_options=gs.options.ViewerOptions(
camera_fov=30,
res=(1280, 720),
),
show_viewer=True,
)
########################## entities ##########################
plane = scene.add_entity(
morph=gs.morphs.Plane(),
)
cloth_1 = scene.add_entity(
material=gs.materials.PBD.Cloth(),
morph=gs.morphs.Mesh(
file="meshes/cloth.obj",
scale=2.0,
pos=(0, 0, 0.5),
euler=(0.0, 0, 0.0),
),
surface=gs.surfaces.Default(
color=(0.2, 0.4, 0.8, 1.0),
vis_mode="visual",
),
)
cloth_2 = scene.add_entity(
material=gs.materials.PBD.Cloth(),
morph=gs.morphs.Mesh(
file="meshes/cloth.obj",
scale=2.0,
pos=(0, 0, 1.0),
euler=(0.0, 0, 0.0),
),
surface=gs.surfaces.Default(
color=(0.8, 0.4, 0.2, 1.0),
vis_mode="particle",
),
)
########################## build ##########################
scene.build()
cloth_1.fix_particles(cloth_1.find_closest_particle((-1, -1, 1.0)))
cloth_1.fix_particles(cloth_1.find_closest_particle((1, 1, 1.0)))
cloth_1.fix_particles(cloth_1.find_closest_particle((-1, 1, 1.0)))
cloth_1.fix_particles(cloth_1.find_closest_particle((1, -1, 1.0)))
cloth_2.fix_particles(cloth_2.find_closest_particle((-1, -1, 1.0)))
horizon = 1000 if "PYTEST_VERSION" not in os.environ else 5
for i in range(horizon):
scene.step()