Fix all the rotation directions #2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There are very likely inconsistencies in the signs and what I've documented in the comments. I just set the signs through trial and error until it worked.
Check them over and make sure they all adhere to the right hand rule (thumb points towards positive axis direction, curled fingers point towards positive rotation direction).
Relevant lines
# In 3D, the x-axis points to the right, the y-axis points up, and the z-axis points forward.rotation_matrix_yaw = np.array([[np.cos(yaw), 0, np.sin(yaw)],[0, 1, 0 ],[-np.sin(yaw), 0, np.cos(yaw)]])rotation_matrix_pitch = np.array([[1, 0, 0 ],[0, np.cos(pitch), -np.sin(pitch)],[0, np.sin(pitch), np.cos(pitch) ]])rotation_matrix_roll = np.array([[np.cos(roll), np.sin(roll), 0],[-np.sin(roll), np.cos(roll), 0],[0, 0, 1]])# Do logical updates here.if key_is_down[pygame.K_LEFT]:yaw -= delta_yawif key_is_down[pygame.K_RIGHT]:yaw += delta_yawif key_is_down[pygame.K_UP]:pitch += delta_pitchif key_is_down[pygame.K_DOWN]:pitch -= delta_pitchif key_is_down[pygame.K_q]:roll += delta_rollif key_is_down[pygame.K_e]:roll -= delta_roll