Skip to content

Commit

Permalink
Fix cloth attr.
Browse files Browse the repository at this point in the history
  • Loading branch information
YoruCathy committed Apr 27, 2024
1 parent 8ea4627 commit 725b82c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pyrcareworld/pyrcareworld/attributes/cloth_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,30 @@


def parse_message(msg: IncomingMessage) -> dict:
"""
Fetches the same information as a base_attr, but with the additional
`"particle_groups"` key. You can do `dict["particle_groups"][particle_group_name]` to get the list of positions, which are each represented as a 3-length list.
Returns:
dict: The same information as base_attr, but with the additional
`"particle_groups"` key.
"""
this_object_data = attr.base_attr.parse_message(msg)
count = msg.read_int32()
this_object_data["particle_groups"] = {}
for _ in range(count):
# First is the particle group name.
name = msg.read_string()
# Finally is the xs list, then the ys list, then the zs list.
xs = msg.read_float32_list()
ys = msg.read_float32_list()
zs = msg.read_float32_list()

# Make a couple of lists
positions = [[x, y, z] for x, y, z in zip(xs, ys, zs)]

this_object_data["particle_groups"][name] = positions

return this_object_data


Expand Down

0 comments on commit 725b82c

Please sign in to comment.