角色动画
This commit is contained in:
@@ -156,12 +156,12 @@ func _rebuild_cable() -> void:
|
||||
prev = p
|
||||
# 截面参考轴取「切线 × 世界上方向」。切线接近竖直时叉乘会退化成零向量,
|
||||
# 这时换 RIGHT 兜底,否则 normalize() 会吐 NaN 把整根缆搅烂。
|
||||
var tan := (_local_sample(minf(t + 0.01, 1.0)) - _local_sample(maxf(t - 0.01, 0.0))).normalized()
|
||||
var n := tan.cross(Vector3.UP)
|
||||
var tan_dir := (_local_sample(minf(t + 0.01, 1.0)) - _local_sample(maxf(t - 0.01, 0.0))).normalized()
|
||||
var n := tan_dir.cross(Vector3.UP)
|
||||
if n.length_squared() < 0.0001:
|
||||
n = tan.cross(Vector3.RIGHT)
|
||||
n = tan_dir.cross(Vector3.RIGHT)
|
||||
n = n.normalized()
|
||||
var binormal := n.cross(tan).normalized()
|
||||
var binormal := n.cross(tan_dir).normalized()
|
||||
for j in range(RING_SEGMENTS + 1):
|
||||
var ang := TAU * float(j) / float(RING_SEGMENTS)
|
||||
var off := n * cos(ang) + binormal * sin(ang)
|
||||
|
||||
Reference in New Issue
Block a user