messing around with path3d stuff

This commit is contained in:
Clevertop 2024-08-12 00:10:55 +10:00
parent 34fed07cc6
commit e9a896a912
4 changed files with 32 additions and 25 deletions

View file

@ -1,21 +1,22 @@
#@tool
@tool
extends RigidBody3D
class_name Command_Block
#TODO make this all an enum
@export var command_name : String
@export var command_sprite : Texture2D#:
@export var mesh : MeshInstance3D
@export var command_sprite : Texture2D:
set(new_texture):
command_sprite = new_texture
mesh.material_override = mesh.material_override.duplicate()
mesh.material_override.albedo_texture = command_sprite
@export var collider : CollisionShape3D
var spawn_pos : Vector3
#set(new_texture):
#if command_sprite != null:
#command_sprite.changed.disconnect(on_texture_changed)
#command_sprite = new_texture
#command_sprite.changed.connect(on_texture_changed)
# Called when the node enters the scene tree for the first time.
func _ready():
$MeshInstance3D.material_override = $MeshInstance3D.material_override.duplicate()
$MeshInstance3D.material_override.albedo_texture = command_sprite
mesh.material_override = mesh.material_override.duplicate()
mesh.material_override.albedo_texture = command_sprite
spawn_pos = global_position
pass # Replace with function body.
@ -27,7 +28,4 @@ func _process(delta):
linear_velocity = Vector3(0,0,0)
pass
#func on_texture_changed():
#print("meow")
#$MeshInstance3D.material_override = $MeshInstance3D.material_override.duplicate()
#$MeshInstance3D.material_override.albedo_texture = command_sprite

View file

@ -1,21 +1,29 @@
[gd_scene load_steps=6 format=3 uid="uid://dqvq4ybcpws87"]
[ext_resource type="Material" uid="uid://2i80f5wutvco" path="res://Assets/Materials/baseCommand.tres" id="1_ksvsv"]
[ext_resource type="Script" path="res://Commands/command_block.gd" id="1_ra6j6"]
[ext_resource type="Script" path="res://Commands/tool.gd" id="3_lrl7m"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cywoj"]
emission = Color(1, 1, 1, 1)
subsurf_scatter_strength = 1.0
uv1_scale = Vector3(3, 2, 1)
uv1_triplanar_sharpness = 0.0583145
uv2_triplanar_sharpness = 0.170755
texture_filter = 0
[sub_resource type="BoxMesh" id="BoxMesh_572kf"]
size = Vector3(0.5, 0.5, 0.5)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_mmdx7"]
points = PackedVector3Array(0.25, 0.25, 0.25, 0.25, 0.25, -0.25, -0.25, 0.25, 0.25, 0.25, -0.25, 0.25, 0.25, -0.25, -0.25, -0.25, 0.25, -0.25, -0.25, -0.25, 0.25, -0.25, -0.25, -0.25)
[node name="BaseCommand" type="RigidBody3D" node_paths=PackedStringArray("collider")]
[node name="BaseCommand" type="RigidBody3D" node_paths=PackedStringArray("mesh", "collider")]
script = ExtResource("1_ra6j6")
mesh = NodePath("MeshInstance3D")
collider = NodePath("CollisionShape3D3")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
material_override = ExtResource("1_ksvsv")
material_override = SubResource("StandardMaterial3D_cywoj")
mesh = SubResource("BoxMesh_572kf")
script = ExtResource("3_lrl7m")