feat: humanoid player model without animations
This commit is contained in:
+10
-18
@@ -1,7 +1,7 @@
|
||||
extends StaticBody3D
|
||||
class_name TargetDummy
|
||||
|
||||
var mesh_instance: MeshInstance3D
|
||||
var visual_node: Node3D
|
||||
var dps_label: Label3D
|
||||
|
||||
# Array of dictionaries: { "time": float, "amount": float }
|
||||
@@ -18,19 +18,11 @@ func _ready() -> void:
|
||||
shape.position = Vector3(0, 1.0, 0)
|
||||
add_child(shape)
|
||||
|
||||
# Mesh
|
||||
mesh_instance = MeshInstance3D.new()
|
||||
var mesh = CapsuleMesh.new()
|
||||
mesh.radius = 0.5
|
||||
mesh.height = 2.0
|
||||
mesh_instance.mesh = mesh
|
||||
|
||||
var mat = StandardMaterial3D.new()
|
||||
mat.albedo_color = Color(0.8, 0.2, 0.2) # Red dummy
|
||||
mat.roughness = 0.7
|
||||
mesh.material = mat
|
||||
mesh_instance.position = Vector3(0, 1.0, 0)
|
||||
add_child(mesh_instance)
|
||||
# Humanoid Model
|
||||
visual_node = load("res://characters/humanoid_model.gd").new()
|
||||
visual_node.name = "HumanoidModel"
|
||||
visual_node.color = Color(0.8, 0.2, 0.2)
|
||||
add_child(visual_node)
|
||||
|
||||
# DPS Label
|
||||
dps_label = Label3D.new()
|
||||
@@ -75,11 +67,11 @@ func _update_dps() -> void:
|
||||
func _wiggle() -> void:
|
||||
# Small tween to shake the dummy
|
||||
var tween = create_tween()
|
||||
var orig_pos = Vector3(0, 1.0, 0)
|
||||
var orig_pos = Vector3.ZERO
|
||||
var wiggle_dir = Vector3(randf_range(-0.1, 0.1), 0, randf_range(-0.1, 0.1))
|
||||
|
||||
tween.tween_property(mesh_instance, "position", orig_pos + wiggle_dir, 0.05)
|
||||
tween.tween_property(mesh_instance, "position", orig_pos - wiggle_dir, 0.05)
|
||||
tween.tween_property(mesh_instance, "position", orig_pos, 0.05)
|
||||
tween.tween_property(visual_node, "position", orig_pos + wiggle_dir, 0.05)
|
||||
tween.tween_property(visual_node, "position", orig_pos - wiggle_dir, 0.05)
|
||||
tween.tween_property(visual_node, "position", orig_pos, 0.05)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user