jetpack stuttering, physics updates, deps upgrades

This commit is contained in:
anyreso 2024-11-06 14:24:28 +00:00
parent 36168ed18c
commit bbf551f3fa
101 changed files with 2302 additions and 1740 deletions

View file

@ -42,22 +42,22 @@ func editor_setup(p_plugin) -> void:
func get_terrain() -> Terrain3D:
var terrain := instance_from_id(_terrain_id) as Terrain3D
if not terrain or terrain.is_queued_for_deletion() or not terrain.is_inside_tree():
var terrains: Array[Node] = EditorInterface.get_edited_scene_root().find_children("", "Terrain3D")
var terrains: Array[Node] = Engine.get_singleton(&"EditorInterface").get_edited_scene_root().find_children("", "Terrain3D")
if terrains.size() > 0:
terrain = terrains[0]
_terrain_id = terrain.get_instance_id() if terrain else 0
if terrain and terrain.storage and not terrain.storage.maps_edited.is_connected(_on_maps_edited):
terrain.storage.maps_edited.connect(_on_maps_edited)
if terrain and terrain.data and not terrain.data.maps_edited.is_connected(_on_maps_edited):
terrain.data.maps_edited.connect(_on_maps_edited)
return terrain
func _get_terrain_height(p_global_position: Vector3) -> float:
var terrain: Terrain3D = get_terrain()
if not terrain or not terrain.storage:
if not terrain or not terrain.data:
return 0.0
var height: float = terrain.storage.get_height(p_global_position)
var height: float = terrain.data.get_height(p_global_position)
if is_nan(height):
return 0.0
return height
@ -105,7 +105,7 @@ func _on_child_exiting_tree(p_node: Node) -> void:
func _is_node_selected(p_node: Node) -> bool:
var editor_sel = EditorInterface.get_selection()
var editor_sel = Engine.get_singleton(&"EditorInterface").get_selection()
return editor_sel.get_transformable_selected_nodes().has(p_node)