save
This commit is contained in:
parent
ad95711535
commit
2e310f4053
25 changed files with 852 additions and 74 deletions
|
@ -2,6 +2,7 @@
|
|||
extends Path3D
|
||||
class_name RoadPath
|
||||
@export_tool_button("update_control_points") var action = update_control_points
|
||||
var tilt_scale : float = 0.0005
|
||||
|
||||
func modulo_get_point_position(i):
|
||||
return curve.get_point_position(posmod(i, curve.point_count))
|
||||
|
@ -10,14 +11,6 @@ func update_control_points():
|
|||
if curve.point_count < 2:
|
||||
return
|
||||
|
||||
#
|
||||
## Start point: out control based on next point
|
||||
#var dir = (curve.get_point_position(1) - curve.get_point_position(0)).normalized()
|
||||
#var tangent_length = dir.length() / 3
|
||||
#
|
||||
#curve.set_point_out(0, dir * tangent_length)
|
||||
|
||||
# Intermediate points: in and out controls based on adjacent points
|
||||
for i in range(0, curve.point_count):
|
||||
var prev = modulo_get_point_position(i) - modulo_get_point_position(i - 1)
|
||||
var next = modulo_get_point_position(i + 1) - modulo_get_point_position(i)
|
||||
|
@ -30,3 +23,6 @@ func update_control_points():
|
|||
tangent = tangent.normalized()
|
||||
curve.set_point_in(i, -tangent * tangent_length)
|
||||
curve.set_point_out(i, tangent * tangent_length)
|
||||
|
||||
var tilt = -prev.cross(next).y * tilt_scale
|
||||
curve.set_point_tilt(i, tilt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue