Preserve initial outfit review and tested heel-safe gait for reference revision
This commit is contained in:
+14
-7
@@ -16,6 +16,10 @@ var initialized=false
|
||||
var moving=false
|
||||
var stride=1.55
|
||||
var last_direction=Vector3.ZERO
|
||||
var stride_min=1.25
|
||||
var stride_max=1.65
|
||||
var track_width=.065
|
||||
var swing_height=.15
|
||||
|
||||
func setup(owner_actor):
|
||||
actor=owner_actor;skeleton=actor.find_children("*","Skeleton3D",true,false)[0]
|
||||
@@ -67,7 +71,7 @@ func landing(f,progress,travel_direction):
|
||||
# Narrow catwalk track, with enough clearance for the boots to pass each other.
|
||||
var side=1.0 if f.side=="L" else -1.0
|
||||
var destination=actor.global_position+travel_direction*((1.0-progress)*stride+stride*.25)
|
||||
destination+=actor.global_basis.x.normalized()*side*.065*scale_y
|
||||
destination+=actor.global_basis.x.normalized()*side*track_width*scale_y
|
||||
destination.y=ground_height(f)
|
||||
return destination
|
||||
|
||||
@@ -81,7 +85,7 @@ func update(dt):
|
||||
var was_moving=moving;moving=distance>.00015 and dt>0
|
||||
var scale_y=actor.global_basis.get_scale().y
|
||||
# Longer steps at higher upgrade speeds; phase still follows the actual distance.
|
||||
stride=lerpf(1.25,1.65,clampf((last_speed/scale_y-1.3)/2.0,0,1))*scale_y
|
||||
stride=lerpf(stride_min,stride_max,clampf((last_speed/scale_y-1.3)/2.0,0,1))*scale_y
|
||||
walk_weight=move_toward(walk_weight,1.0 if moving else 0.0,dt*7)
|
||||
if moving:
|
||||
distance_walked+=distance;phase=fposmod(phase+distance/stride,1.0)
|
||||
@@ -103,7 +107,7 @@ func update(dt):
|
||||
var u=clampf((p-f.start_phase)/maxf(.01,1.0-f.start_phase),0,1)
|
||||
var ease=u*u*(3-2*u)
|
||||
f.target=f.start.lerp(f.landing,ease)
|
||||
f.target.y=ground_height(f)+sin(u*PI)*.15*scale_y
|
||||
f.target.y=ground_height(f)+sin(u*PI)*swing_height*scale_y
|
||||
else:
|
||||
if not f.grounded:
|
||||
f.anchor=f.landing;f.anchor.y=ground_height(f);f.yaw=actor.global_rotation.y;f.grounded=true
|
||||
@@ -146,7 +150,10 @@ func update(dt):
|
||||
skeleton.set_bone_pose_position(bones["root"],skeleton.to_local(root_position));skeleton.force_update_all_bone_transforms()
|
||||
for f in feet:
|
||||
leg(f,f.target)
|
||||
var yaw=f.yaw if f.grounded else actor.global_rotation.y
|
||||
var foot_rotation=Quaternion(Vector3.UP,yaw)*f.rotation
|
||||
if not f.grounded:foot_rotation=Quaternion(actor.global_basis.x.normalized(),sin(maxf(0,f.last_phase-.5)*TAU)*-.12)*foot_rotation
|
||||
set_rotation("foot."+f.side,foot_rotation)
|
||||
set_rotation("foot."+f.side,foot_orientation(f,dt))
|
||||
|
||||
func foot_orientation(f,_dt):
|
||||
var yaw=f.yaw if f.grounded else actor.global_rotation.y
|
||||
var orientation=Quaternion(Vector3.UP,yaw)*f.rotation
|
||||
if not f.grounded:orientation=Quaternion(actor.global_basis.x.normalized(),sin(maxf(0,f.last_phase-.5)*TAU)*-.12)*orientation
|
||||
return orientation
|
||||
|
||||
Reference in New Issue
Block a user