extends RigidBody3D @onready var objMesh = $MeshInstance3D @onready var objCollision = $CollisionShape3D @export_enum("default","wood") var objMaterial = "default" @export var autoGlue:bool = false ## Toggles wether or not it sticks to nearby objects on spawn. @export var properties:Dictionary = { ## The properties the object will have upon spawning. "size": Vector3(0.1,0.1,0.1), "modifiers": { "magnetic": false, }, } @export var gluedTo:Array[NodePath] ## Nodes that this object will be glued to (press "Add Element" and assign the node.) var materials:Dictionary = { "default":{"weight":1,"material":null,"modifiers":[]}, "wood":{"weight":5,"material":"res://assets/wood.tres","modifiers":[]} } func _ready(): setBasics() #sets the basic weight, shape, and material of the object func setBasics(): var mat = materials[objMaterial] objMesh.mesh.size = properties["size"] objCollision.shape.size = properties["size"] $glueBox/CollisionShape3D.shape.size = properties["size"] + Vector3(0.02,0.02,0.02) if mat["material"] != null: var i = load(mat["material"]) objMesh.mesh.material = i mass = mat["weight"] * (properties["size"].x + properties["size"].y + properties["size"].z)