Fixed gimbal lock by fixing the quaternion multiplication order when getting absolute rotation for camera entity

dev
Shariq Shah 6 years ago
parent 7134d23e6b
commit 11b2f2da14
  1. 6
      src/game/player.c
  2. 3
      src/game/transform.c
  3. 4
      todo.txt

@ -106,14 +106,10 @@ void player_update(struct Player* player, struct Scene* scene, float dt)
}
if(yaw != 0.f)
{
transform_rotate(player->camera_node, &rot_axis_yaw, -yaw, TS_WORLD);
}
transform_rotate(player, &rot_axis_yaw, -yaw, TS_WORLD);
if(pitch != 0.f)
{
transform_rotate(player->camera_node, &rot_axis_pitch, pitch, TS_LOCAL);
}
/* Movement */
float move_speed = player->move_speed;

@ -319,7 +319,8 @@ void transform_get_absolute_rot(struct Entity* entity, quat* res)
done = true;
break;
}
quat_mul(res, res, &parent->transform.rotation);
//quat_mul(res, res, &parent->transform.rotation);
quat_mul(res, &parent->transform.rotation, res);
parent = parent->transform.parent;
}
}

@ -1,10 +1,11 @@
Todo:
- Fix gimbal lock in fps camera
- Fix hierarchical transforms not working in editor mode
- Fix weird rotational bug when rotation resets or inverts after 180 degrees
- Better, more accurate picking
- Add editor undo for transformation operations
- Add material export for blender exporter?
- Remove flickering from selection in editor
- Fix crash when exiting from fullscreen mode
- Allow renaming scene objects in editor
- Check if we still need to rotate by 90 degrees when exporting from blender
- Fire an event when the game mode is changed so that editor camera state and other game related systems know when to update
@ -355,3 +356,4 @@ Done:
* Added parameter to entity_load command that renames the newly loaded object to whatever the second specified parameter is
* Implment/Test reading/writing scene that has a mixture of default entites and entity archetypes
* Add simple player fps controls
* Fixed gimbal lock in fps camera by fixing the order of quaternion multiplication when getting absolute rotation
Loading…
Cancel
Save