-void DirectInput::SelectInventory(int i) {
- player.SetInventorySlot(i);
-}
-
-void DirectInput::UpdatePlayer() {
- constexpr float max_vel = 0.005f;
- if (dirty) {
- player.GetEntity().Orientation(glm::quat(glm::vec3(pitch, yaw, 0.0f)));
- player.GetEntity().Velocity(glm::rotateY(move_dir * max_vel, yaw));
-
- Ray aim = player.Aim();
- if (!world.Intersection(aim, glm::mat4(1.0f), player.GetEntity().ChunkCoords(), aim_world)) {
- aim_world = WorldCollision();
- }
- if (!world.Intersection(aim, glm::mat4(1.0f), player.GetEntity(), aim_entity)) {
- aim_entity = EntityCollision();
- }
- if (aim_world && aim_entity) {
- // got both, pick the closest one
- if (aim_world.depth < aim_entity.depth) {
- aim_entity = EntityCollision();
- } else {
- aim_world = WorldCollision();
- }
- }
- // TODO: update outline if applicable
- dirty = false;
- }
-}
-