Skip to content

Fov #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Fov #108

wants to merge 3 commits into from

Conversation

jb0gie
Copy link

@jb0gie jb0gie commented Jul 17, 2025

Description

This PR implements Field of View (FOV) as a core feature in Hyperfy, allowing users to adjust their camera field of view through the settings interface. The FOV setting is now available in both the SettingsPane and MenuMain components, with proper server-side synchronization and camera integration.

Key Changes:

  • Added FOV setting to Sidebar Prefs component with number input (30-120degrees)
  • Added FOV setting to MenuMainGraphics component with range slider
  • Implemented server-side FOV synchronization via world.settings.set(fov, value, true)
  • Added FOV synchronization in PlayerLocal entity for proper camera control
  • Fixed duplicate Ambient Occlusion setting by using server-side settings
  • Temporarily hidden ContextMenu for PR focus on core FOV feature

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Code refactoring (no functional changes)

Testing

  • FOV setting appears in SettingsPane graphics section
  • FOV setting appears in MenuMain graphics section
  • FOV changes are properly synchronized to server
  • Camera FOV updates immediately when setting is changed
  • FOV persists across sessions via server-side settings
  • FOV range is properly constrained (30-120ees)
  • Default FOV value of 70 degrees is applied correctly

Implementation Details

Server-Side Settings Integration

  • FOV is stored in world.settings.fov (server-side)
  • Changes are broadcast to all clients with world.settings.set('fov', fov, true)
  • Default value of 70es
  • Proper serialization/deserialization

Camera Integration

  • Direct camera FOV updates: world.camera.fov = value
  • Projection matrix updates: world.camera.updateProjectionMatrix()
  • Synchronization between settings and camera
  • Fallback to camera FOV if no setting exists

UI Integration

  • FOV slider in SettingsPane (30120grees)
  • FOV range slider in MenuMainGraphics
  • Number input in Sidebar Prefs for precise control
  • Proper state management and change listeners

Player Camera Synchronization

  • Added FOV sync in PlayerLocal entity's lateUpdate method
  • Ensures player camera control respects FOV settings
  • Prevents camera control from overriding FOV changes

Files Changed

Core Implementation

  • src/core/entities/PlayerLocal.js - Added FOV synchronization
  • src/core/systems/ClientControls.js - FOV settings change handling
  • src/core/systems/Settings.js - Server-side FOV property

UI Components

  • src/client/components/SettingsPane.js - Added FOV setting with range slider
  • src/client/components/MenuMain.js - Added FOV setting with range slider
  • src/client/components/Sidebar.js - Added FOV setting with number input
  • src/client/components/ContextMenu.js - Temporarily hidden for PR focus

Breaking Changes

None - this is a purely additive feature that doesn't break existing functionality.

Additional Notes

  • ContextMenu has been temporarily hidden to focus on the core FOV feature implementation
  • Ambient Occlusion setting was also fixed to use server-side settings instead of client preferences
  • FOV implementation follows the same pattern as other server-side settings like AO

Screenshots

FOV setting now appears in:

  • SettingsPane graphics section with range slider
  • MenuMain graphics section with range slider
  • Sidebar Prefs with number input for precise control

The FOV setting properly integrates with the existing settings system and provides immediate visual feedback when adjusted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant