Integrate five Meshy apparatus with fitted soul poses and anchored restraints
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
extends RefCounted
|
||||
# Water, restraints and moving controls stay independent of the Meshy surfaces.
|
||||
const MODELS={
|
||||
0:preload("res://art/equipment/meshy_v01/pillory.glb"),
|
||||
1:preload("res://art/equipment/meshy_v01/rack.glb"),
|
||||
2:preload("res://art/equipment/meshy_v01/wheel_vat.glb"),
|
||||
4:preload("res://art/equipment/meshy_v01/musical_chair.glb"),
|
||||
5:preload("res://art/equipment/meshy_v01/cauldron.glb")}
|
||||
static var collisions={}
|
||||
func build(g,d):
|
||||
var root=d.device
|
||||
var model=MODELS[d.selected].instantiate();root.add_child(model)
|
||||
root.set_meta("apparatus_model","meshy_equipment_v01")
|
||||
for mesh in model.find_children("*","MeshInstance3D",true,false):
|
||||
var key=str(d.selected)+"/"+str(mesh.name)
|
||||
if not collisions.has(key):collisions[key]=mesh.mesh.create_convex_shape(true,true)
|
||||
mesh.set_meta("walk_collision_shape",collisions[key])
|
||||
if d.selected==0:root.set_meta("pillory_apertures",3)
|
||||
if d.selected==2:
|
||||
d.crank=model.find_child("Wheel",true,false)
|
||||
assert(d.crank!=null,"The wheel requires a separate axle pivot")
|
||||
root.set_meta("wheel_radius",1.28)
|
||||
# Central axle is perpendicular to the wheel; the frame stays behind it.
|
||||
var axle=g.cylinder(root,Vector3(0,1.62,-.31),.12,.52,Color("332e28"));axle.rotation.x=PI/2
|
||||
g.line(root,Vector3(-1.34,1.62,-.53),Vector3(1.34,1.62,-.53),.085,Color("453124"))
|
||||
for side in [-1,1]:
|
||||
g.box(root,Vector3(side*1.35,1.62,-.25),Vector3(.28,.28,.28),Color("332e28"))
|
||||
for y in [1.53,1.71]:g.ball(root,Vector3(side*1.35,y,-.09),Vector3.ONE*.045,Color("89734b"))
|
||||
if d.selected in [1,2]:
|
||||
var handle=Node3D.new();root.add_child(handle);handle.name="WindingHandle"
|
||||
handle.position=Vector3(1.0,1.08,-1.34) if d.selected==1 else Vector3(1.48,1.62,0)
|
||||
handle.rotation.y=PI/2
|
||||
var pivot=Node3D.new();handle.add_child(pivot);pivot.name="HandleRotor"
|
||||
g.line(pivot,Vector3.ZERO,Vector3(.25,0,0),.035,Color("38332c"))
|
||||
g.line(pivot,Vector3(.25,0,0),Vector3(.25,0,.20),.04,Color("61432b"))
|
||||
for mesh in handle.find_children("*","MeshInstance3D",true,false):mesh.set_meta("no_walk_collision",true)
|
||||
if d.selected==1:d.crank=pivot
|
||||
root.set_meta("handle_rotor",pivot)
|
||||
if d.selected==4:
|
||||
for side in [-1,1]:
|
||||
var speaker=Node3D.new();root.add_child(speaker);speaker.name="InwardFacingSpeaker"
|
||||
speaker.position=Vector3(side*.90,1.75,-.18)
|
||||
var direction=Vector3(0,1.75,-.12)-speaker.position
|
||||
speaker.rotation.y=atan2(direction.x,direction.z)
|
||||
d.special.speaker_roots.append(speaker)
|
||||
# Invisible measured contact proxy for the upholstered seat surface.
|
||||
var seat=MeshInstance3D.new();root.add_child(seat);seat.name="ChairSeat";seat.position=Vector3(0,.64,-.12)
|
||||
var contact=BoxMesh.new();contact.size=Vector3(.96,.12,.48);seat.mesh=contact;seat.hide();seat.set_meta("no_walk_collision",true)
|
||||
d.special["seat"]=seat
|
||||
var rest=g.box(root,Vector3(0,.29,.53),Vector3(.85,.08,.38),Color("3e3028"));rest.name="ChairFootrest"
|
||||
Reference in New Issue
Block a user