25 lines
1.1 KiB
GDScript
25 lines
1.1 KiB
GDScript
|
|
extends SceneTree
|
||
|
|
class Game:
|
||
|
|
extends RefCounted
|
||
|
|
var paused=false
|
||
|
|
func _initialize():call_deferred("run")
|
||
|
|
func lean(a):
|
||
|
|
var hip=a.gait.point("root");var head=a.gait.point("head")
|
||
|
|
var v=a.global_basis.inverse()*(head-hip)
|
||
|
|
return rad_to_deg(atan2(v.x,v.y))
|
||
|
|
func run():
|
||
|
|
var g=Game.new();var anchor=Node3D.new();root.add_child(anchor)
|
||
|
|
var actor=preload("res://succubus_actor.gd").new();anchor.add_child(actor);actor.configure(g);actor.set_process(false);actor.rotation=Vector3.ZERO;actor.reset_gait()
|
||
|
|
for mode in ["constant_walk","stop_start","idle","whip_then_walk"]:
|
||
|
|
var minimum=999.0;var maximum=-999.0
|
||
|
|
for frame in range(1800):
|
||
|
|
var moving=mode=="constant_walk" or (mode=="stop_start" and frame%30<15) or (mode=="whip_then_walk" and frame%90>30)
|
||
|
|
actor.set_walking(moving)
|
||
|
|
if moving:anchor.position+=Vector3.BACK*3.3/60
|
||
|
|
if mode=="whip_then_walk" and frame%90==0:actor.strike(.45)
|
||
|
|
actor._process(1.0/60)
|
||
|
|
minimum=minf(minimum,lean(actor));maximum=maxf(maximum,lean(actor))
|
||
|
|
print("LEAN ",mode," min=",minimum," max=",maximum," end=",lean(actor))
|
||
|
|
actor.game=null;actor.queue_free();await process_frame
|
||
|
|
quit()
|