Skip to content

Commit

Permalink
added max slope variable to Project on Terrain modifier for Proton Sc…
Browse files Browse the repository at this point in the history
…atter
  • Loading branch information
DissonantVoid committed Jan 6, 2025
1 parent 4a04728 commit 5a0422c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions project/addons/terrain_3d/extras/project_on_terrain3d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#
#@export var terrain_node : NodePath
#@export var align_with_collision_normal := false
#@export var max_slope := 90.0
#
#var _terrain: Terrain3D
#
Expand Down Expand Up @@ -69,17 +70,26 @@
## Get global transform
#var gt: Transform3D = domain.get_global_transform()
#var gt_inverse := gt.affine_inverse()
#var new_transforms_array : Array[Transform3D] = []
#for i in transforms.list.size():
#var location: Vector3 = (gt * transforms.list[i]).origin
#var t: Transform3D = transforms.list[i]
#
#var location: Vector3 = (gt * t).origin
#var height: float = _terrain.data.get_height(location)
#var normal: Vector3 = _terrain.data.get_normal(location)
#
#if align_with_collision_normal and not is_nan(normal.x):
#transforms.list[i].basis.y = normal
#transforms.list[i].basis.x = -transforms.list[i].basis.z.cross(normal)
#transforms.list[i].basis = transforms.list[i].basis.orthonormalized()
#t.basis.y = normal
#t.basis.x = -t.basis.z.cross(normal)
#t.basis = t.basis.orthonormalized()
#
#var remapped_max_slope = remap(max_slope, 0.0, 90.0, 0.0, 1.0)
#if abs(Vector3.UP.dot(normal)) >= (1.0 - remapped_max_slope):
#t.origin.y = gt.origin.y if is_nan(height) else height - gt.origin.y
#new_transforms_array.push_back(t)
#
#transforms.list[i].origin.y = gt.origin.y if is_nan(height) else height - gt.origin.y
#transforms.list.clear()
#transforms.list.append_array(new_transforms_array)
#
#if transforms.is_empty():
#warning += """Every point has been removed. Possible reasons include: \n
Expand Down

0 comments on commit 5a0422c

Please sign in to comment.