Replace imps with rigged swamp demon and adapt gait and activities
This commit is contained in:
@@ -5,11 +5,38 @@ func check(ok,label):
|
||||
func shot(g,name):
|
||||
await g.get_tree().process_frame;await RenderingServer.frame_post_draw
|
||||
g.get_viewport().get_texture().get_image().save_png("res://captures/imps-v02/"+name+".png")
|
||||
func verify_skin(imp):
|
||||
var skin=imp.gait.skin
|
||||
check(skin.skeleton.get_bone_count()==14,"all fourteen skin joints imported")
|
||||
for binding in skin.bindings:
|
||||
var actual=skin.skeleton.global_transform*skin.skeleton.get_bone_global_pose(binding.index)
|
||||
check(actual.origin.distance_to(binding.control.global_position)<.0001,"skin follows IK control: "+str(binding.index))
|
||||
var meshes=imp.model.get_node("SwampVisual").find_children("*","MeshInstance3D",true,false)
|
||||
check(meshes.size()==1,"single shared textured mesh per imp")
|
||||
for mesh in meshes:
|
||||
check(mesh.skin!=null and mesh.skin.get_bind_count()==14,"mesh is actually skinned")
|
||||
check(mesh.get_active_material(0).albedo_texture!=null,"original colour texture preserved")
|
||||
var arrays=mesh.mesh.surface_get_arrays(0)
|
||||
var vertices=arrays[Mesh.ARRAY_VERTEX];var bones=arrays[Mesh.ARRAY_BONES];var weights=arrays[Mesh.ARRAY_WEIGHTS]
|
||||
var low=Vector3(INF,INF,INF);var high=-low
|
||||
for i in range(vertices.size()):
|
||||
var pos=Vector3.ZERO;var total=0.0
|
||||
for j in range(4):
|
||||
var weight=weights[i*4+j]
|
||||
if weight<=0:continue
|
||||
var bind=bones[i*4+j];var index=skin.skeleton.find_bone(mesh.skin.get_bind_name(bind))
|
||||
if index<0:index=mesh.skin.get_bind_bone(bind)
|
||||
pos+=(skin.skeleton.get_bone_global_pose(index)*mesh.skin.get_bind_pose(bind)*vertices[i])*weight;total+=weight
|
||||
check(pos.is_finite() and absf(total-1)<.001,"finite normalized deformed vertices")
|
||||
low=low.min(pos);high=high.max(pos)
|
||||
check((high-low).length()<2.8,"skin remains bounded without exploding vertices")
|
||||
func run(g):
|
||||
await g.get_tree().create_timer(.3).timeout
|
||||
g.start_game();g.set_process(false);g.reset_shift();g.game_started=true;g.paused=false
|
||||
var imp=g.life.imps[0];var gait=imp.gait
|
||||
check(imp.model.get_meta("model_revision")==2 and imp.model.has_node("LegL/Knee/Foot") and imp.model.has_node("ArmR/Elbow") and imp.model.has_node("Head/EyeL"),"new articulated model")
|
||||
check(imp.model.get_meta("model_revision")==3 and imp.model.has_node("LegL/Knee/Foot") and imp.model.has_node("ArmR/Elbow") and imp.model.has_node("SwampVisual"),"new articulated model")
|
||||
verify_skin(imp)
|
||||
for actor in g.life.imps+g.life.neighbours:check(actor.model.get_meta("model_asset")=="swamp_v01","replacement applied to all 28 imps")
|
||||
for fps in [30,60,144]:
|
||||
for speed in [.5,1.25]:
|
||||
imp.root.position=Vector3(3,0,2);imp.root.rotation=Vector3.ZERO;imp.model.rotation=Vector3.ZERO;imp.model.position=Vector3.ZERO
|
||||
@@ -24,6 +51,7 @@ func run(g):
|
||||
var f=gait.feet[i];max_error=maxf(max_error,f.foot.global_position.distance_to(f.target));min_floor=minf(min_floor,f.foot.global_position.y-.052)
|
||||
if not f.swing and not last[i].swing and f.anchor.is_equal_approx(last[i].anchor):max_slide=maxf(max_slide,f.foot.global_position.distance_to(last[i].at))
|
||||
check(max_error<.006,"foot reach %d %.2f"%[fps,speed]);check(max_slide<.004,"planted hoof slip %d %.2f"%[fps,speed]);check(min_floor>-.005,"hooves stay above floor")
|
||||
verify_skin(imp)
|
||||
var phase=gait.phase
|
||||
for i in range(fps):gait.update(1.0/fps)
|
||||
check(is_equal_approx(gait.phase,phase),"blocked imp does not march in place")
|
||||
@@ -37,10 +65,14 @@ func run(g):
|
||||
g.life.move_imp(imp,Vector3(1,0,0),1.0/60)
|
||||
check(imp.root.position.distance_to(before)<.04,"crowd avoidance has no teleport pushes")
|
||||
check(absf(angle_difference(yaw,imp.root.rotation.y))<=.051,"turn speed bounded")
|
||||
DirAccess.make_dir_recursive_absolute("res://captures/imps-v02")
|
||||
for kind in ["clean","mop","draw","hum"]:
|
||||
if kind=="clean" and g.workshop.stations.is_empty():g.workshop.add_station(0,Vector3(2,0,0));g.workshop.rebuild_nav()
|
||||
g.life.activities.finish(imp);g.life.activities.start(imp,kind);imp.root.position=imp.activity_target;gait.reset()
|
||||
for i in range(50):g.life.activities.update(imp,.02);gait.update(.02,true)
|
||||
verify_skin(imp)
|
||||
g.hud.hide();g.player.hide();g.camera.position=imp.root.position+Vector3(2,1.6,3);g.camera.look_at(imp.root.position+Vector3(0,.65,0));g.camera.size=2.6
|
||||
await shot(g,"activity-"+kind)
|
||||
var arm=imp.model.get_node("ArmR").rotation;g.life.activities.finish(imp);gait.update(.02,false)
|
||||
check(imp.model.get_node("ArmR").rotation.distance_to(arm)<.35,"activity returns smoothly to walking")
|
||||
DirAccess.make_dir_recursive_absolute("res://captures/imps-v02")
|
||||
|
||||
Reference in New Issue
Block a user