add shader to character that is 'it'

This commit is contained in:
EvanGee 2024-06-04 10:40:01 -06:00
parent c7283297ab
commit 6668bff3dd
7 changed files with 42 additions and 12 deletions

View File

@ -1,6 +1,8 @@
extends StaticBody3D extends Node3D
func grounded(src: Player): func grounded(src: Player):
src._is_grounded = true src._is_grounded = true

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://b00brfkibo5cj"] [gd_scene load_steps=14 format=3 uid="uid://b00brfkibo5cj"]
[ext_resource type="PackedScene" uid="uid://bq654gwim6col" path="res://level/level.glb" id="1_s37in"] [ext_resource type="PackedScene" uid="uid://bq654gwim6col" path="res://level/level.glb" id="1_s37in"]
[ext_resource type="Environment" uid="uid://covjrwmk4rplw" path="res://level/world_environment.tres" id="2_ptkl6"] [ext_resource type="Environment" uid="uid://covjrwmk4rplw" path="res://level/world_environment.tres" id="2_ptkl6"]
@ -6,6 +6,7 @@
[ext_resource type="Script" path="res://addons/smoother/smoother.gd" id="5_2tyle"] [ext_resource type="Script" path="res://addons/smoother/smoother.gd" id="5_2tyle"]
[ext_resource type="Script" path="res://level/PlayerSpawner.gd" id="6_7ww0m"] [ext_resource type="Script" path="res://level/PlayerSpawner.gd" id="6_7ww0m"]
[ext_resource type="MeshLibrary" uid="uid://cgh6y5j8wgi36" path="res://level/mesh_library/level_mesh_library.glb" id="6_d34iv"] [ext_resource type="MeshLibrary" uid="uid://cgh6y5j8wgi36" path="res://level/mesh_library/level_mesh_library.glb" id="6_d34iv"]
[ext_resource type="Script" path="res://level/Ground.gd" id="8_yu1ir"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_ujmev"] [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_ujmev"]
margin = 2.067 margin = 2.067
@ -20,8 +21,7 @@ size = Vector2(100, 100)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_285vp"] [sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_285vp"]
[sub_resource type="BoxShape3D" id="BoxShape3D_kefm0"] [sub_resource type="BoxShape3D" id="BoxShape3D_0y3ka"]
size = Vector3(6.87, 1, 1)
[node name="level" instance=ExtResource("1_s37in")] [node name="level" instance=ExtResource("1_s37in")]
script = ExtResource("2_s1bx6") script = ExtResource("2_s1bx6")
@ -95,13 +95,7 @@ shape = SubResource("BoxShape3D_m3lo5")
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="." index="9"] [node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="." index="9"]
replication_config = SubResource("SceneReplicationConfig_285vp") replication_config = SubResource("SceneReplicationConfig_285vp")
[node name="StaticBody3D" type="StaticBody3D" parent="." index="10"] [node name="SharedUI" type="Control" parent="." index="10"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" index="0"]
transform = Transform3D(1.5, 0, 0, 0, 3.2, 0, 0, 0, 10, 5.01694, 11.1202, -5.176)
shape = SubResource("BoxShape3D_kefm0")
[node name="SharedUI" type="Control" parent="." index="11"]
layout_mode = 3 layout_mode = 3
anchors_preset = 0 anchors_preset = 0
offset_right = 40.0 offset_right = 40.0
@ -113,5 +107,12 @@ layout_mode = 0
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
[node name="Ground" type="Area3D" parent="." index="11"]
transform = Transform3D(9, 0, 0, 0, 9, 0, 0, 0, 9, 4.85232, 7.93442, -4.42363)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground" index="0"]
shape = SubResource("BoxShape3D_0y3ka")
script = ExtResource("8_yu1ir")
[connection signal="despawned" from="PlayerSpawner" to="." method="client_remove_player"] [connection signal="despawned" from="PlayerSpawner" to="." method="client_remove_player"]
[connection signal="spawned" from="PlayerSpawner" to="." method="client_add_player"] [connection signal="spawned" from="PlayerSpawner" to="." method="client_add_player"]

View File

@ -33,6 +33,7 @@ signal check_grounded
func _ready(): func _ready():
if username == "": if username == "":
username = "Player " + name username = "Player " + name
$Sphere.set_instance_shader_parameter("color", Color.DARK_ORANGE)
func is_on_ground() -> bool: func is_on_ground() -> bool:
_is_grounded = false _is_grounded = false

View File

@ -29,6 +29,13 @@ animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={
"materials": {
"skin": {
"use_external/enabled": true,
"use_external/path": "res://player/player_color.tres"
}
}
}
gltf/naming_version=1 gltf/naming_version=1
gltf/embedded_image_handling=1 gltf/embedded_image_handling=1

View File

@ -0,0 +1,8 @@
shader_type spatial;
instance uniform vec3 color : source_color;
void fragment() {
ALBEDO = color;
// Called for every pixel the material is visible on.
}

7
player/player_color.tres Normal file
View File

@ -0,0 +1,7 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://k5oba64lxvnw"]
[ext_resource type="Shader" path="res://player/player_color.gdshader" id="1_mfu2j"]
[resource]
render_priority = 0
shader = ExtResource("1_mfu2j")

View File

@ -41,6 +41,10 @@ FmodManager="*res://addons/fmod/FmodManager.gd"
enabled=PackedStringArray("res://addons/fmod/plugin.cfg", "res://addons/godot_gltf2meshlib-6391ec247cc04f5fe89243b24fad68bc2ed2a96b/addons/gltf2meshlib/plugin.cfg") enabled=PackedStringArray("res://addons/fmod/plugin.cfg", "res://addons/godot_gltf2meshlib-6391ec247cc04f5fe89243b24fad68bc2ed2a96b/addons/gltf2meshlib/plugin.cfg")
[filesystem]
import/fbx/enabled=false
[input] [input]
move_left={ move_left={