mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-30 21:21:10 +00:00 
			
		
		
		
	Add editor freelook navigation scheme settings
Depending on what one is trying to achieve, a different freelook mode
may be more desirable.
This closes #34034.
(cherry picked from commit 8a48fb3517)
			
			
This commit is contained in:
		
							parent
							
								
									bbd381c987
								
							
						
					
					
						commit
						93555d9ccc
					
				
					 3 changed files with 28 additions and 2 deletions
				
			
		|  | @ -2259,9 +2259,27 @@ void SpatialEditorViewport::_update_freelook(real_t delta) { | |||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	const Vector3 forward = camera->get_transform().basis.xform(Vector3(0, 0, -1)); | ||||
| 	const FreelookNavigationScheme navigation_scheme = (FreelookNavigationScheme)EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_navigation_scheme").operator int(); | ||||
| 
 | ||||
| 	Vector3 forward; | ||||
| 	if (navigation_scheme == FREELOOK_FULLY_AXIS_LOCKED) { | ||||
| 		// Forward/backward keys will always go straight forward/backward, never moving on the Y axis.
 | ||||
| 		forward = Vector3(0, 0, -1).rotated(Vector3(0, 1, 0), camera->get_rotation().y); | ||||
| 	} else { | ||||
| 		// Forward/backward keys will be relative to the camera pitch.
 | ||||
| 		forward = camera->get_transform().basis.xform(Vector3(0, 0, -1)); | ||||
| 	} | ||||
| 
 | ||||
| 	const Vector3 right = camera->get_transform().basis.xform(Vector3(1, 0, 0)); | ||||
| 	const Vector3 up = camera->get_transform().basis.xform(Vector3(0, 1, 0)); | ||||
| 
 | ||||
| 	Vector3 up; | ||||
| 	if (navigation_scheme == FREELOOK_PARTIALLY_AXIS_LOCKED || navigation_scheme == FREELOOK_FULLY_AXIS_LOCKED) { | ||||
| 		// Up/down keys will always go up/down regardless of camera pitch.
 | ||||
| 		up = Vector3(0, 1, 0); | ||||
| 	} else { | ||||
| 		// Up/down keys will be relative to the camera pitch.
 | ||||
| 		up = camera->get_transform().basis.xform(Vector3(0, 1, 0)); | ||||
| 	} | ||||
| 
 | ||||
| 	Vector3 direction; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hugo Locurcio
						Hugo Locurcio