-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
questionFurther information is requestedFurther information is requested
Description
When I use the fk operator I get the world positions and rotations (pos, rotmats). Is there a way to convert these back to the original local position/rotation values? As a simple test I'm trying to convert these back and trying to save a new bvh file (by using set_data) and that new bvh doesn't come out right. The animation kinda becomes a jumbled mess. I hope that makes sense.
Here is some simplified code I'm using to test this:
bvh = BVH()
bvh.load(bvh_file)
local_rotations, local_positions, parents, offsets, _, _ = bvh.get_data()
global_positions = local_positions[:, 0, :] # root joint
pos, rotmats = fk(local_rotations, global_positions, offsets, parents)
# now save the first 30 frames to a new bvh file
new_bvh = BVH()
new_bvh.data = bvh.data.copy()
new_positions = np.zeros((30, len(bvh.data['names']), 3))
new_rotations = np.zeros((30, len(bvh.data['names']), 4))
for frame in range(30):
for j in range(len(bvh.data['names'])):
position = pos[frame][j]
rotation = rotmats[frame][j]
quat = from_matrix(rotation)
new_positions[frame][j] = position
new_rotations[frame][j] = quat
new_bvh.set_data(new_rotations, new_positions)
new_bvh.save('test.bvh')
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested