add proper water bomb model

This commit is contained in:
wanp 2025-02-12 22:45:09 -03:00
parent 211ef3bbc7
commit 583f844bac
7 changed files with 95 additions and 22 deletions

BIN
assets/water-bomb.glb Normal file

Binary file not shown.

View File

@ -0,0 +1,47 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://ba2mut58elwrh"
path="res://.godot/imported/water-bomb.glb-e8fb14ce8e64d9818172ffab6efe431a.scn"
[deps]
source_file="res://assets/water-bomb.glb"
dest_files=["res://.godot/imported/water-bomb.glb-e8fb14ce8e64d9818172ffab6efe431a.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=0.2
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={
"materials": {
"Sphere": {
"use_external/enabled": true,
"use_external/path": "res://assets/water_bomb_sphere_mat.tres"
},
"Top": {
"use_external/enabled": true,
"use_external/path": "res://assets/water_bomb_top_mat.tres"
}
}
}
gltf/naming_version=1
gltf/embedded_image_handling=1

View File

@ -0,0 +1,16 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://ruycqsmlhsiw"]
[ext_resource type="Shader" path="res://scenes/interactivity_outline.gdshader" id="1_nmq18"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gi5rt"]
resource_local_to_scene = true
render_priority = 0
shader = ExtResource("1_nmq18")
shader_parameter/color = Color(1, 1, 1, 0)
shader_parameter/size = 1.24
[resource]
next_pass = SubResource("ShaderMaterial_gi5rt")
albedo_color = Color(0.0936238, 0.825356, 1, 1)
metallic = 0.8
roughness = 0.4

View File

@ -0,0 +1,16 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://cm6b807gcxn4w"]
[ext_resource type="Shader" path="res://scenes/interactivity_outline.gdshader" id="1_wfrf5"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_phi16"]
resource_local_to_scene = true
render_priority = 0
shader = ExtResource("1_wfrf5")
shader_parameter/color = Color(1, 1, 1, 0)
shader_parameter/size = 1.24
[resource]
next_pass = SubResource("ShaderMaterial_phi16")
albedo_color = Color(0.207843, 0.211765, 0.8, 1)
metallic = 0.2
roughness = 0.5

View File

@ -76,7 +76,6 @@ func _physics_process(delta: float) -> void:
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
@ -131,6 +130,7 @@ func _unhandled_input(event: InputEvent) -> void:
_projectile_holder.add_child(new_projectile, true)
_set_projectile_authority.rpc(new_projectile.get_path(), id)
new_projectile.set_global_pos.rpc(_projectile_point.global_position)
new_projectile.rotation = rotation
new_projectile.sender_body = self
new_projectile.sender_id = id

View File

@ -20,6 +20,10 @@ func _ready() -> void:
func _process(delta: float) -> void:
# spin around, no need to replicate this
_model.basis = _model.basis.rotated(Vector3(1, 0, 0), -((TAU*2) * delta))
_model.basis = _model.basis.orthonormalized()
if not is_multiplayer_authority():
return
@ -80,8 +84,10 @@ func get_picked_up() -> void:
func mark_interactive() -> void:
(_model as CSGSphere3D).material_override.next_pass.set("shader_parameter/color", Color.WHITE)
for submodel in _model.get_children():
(submodel as MeshInstance3D).mesh.surface_get_material(0).next_pass.set("shader_parameter/color", Color.WHITE)
func mark_non_interactive() -> void:
(_model as CSGSphere3D).material_override.next_pass.set("shader_parameter/color", Color(1, 1, 1, 0))
for submodel in _model.get_children():
(submodel as MeshInstance3D).mesh.surface_get_material(0).next_pass.set("shader_parameter/color", Color(1, 1, 1, 0))

View File

@ -1,10 +1,9 @@
[gd_scene load_steps=15 format=3 uid="uid://tdsbo3e5ic86"]
[gd_scene load_steps=12 format=3 uid="uid://tdsbo3e5ic86"]
[ext_resource type="Script" path="res://src/ingame/water_bomb.gd" id="1_lk5fq"]
[ext_resource type="PackedScene" uid="uid://s2a1pry5fw8f" path="res://scenes/water_bomb_model.tscn" id="2_0lxuq"]
[ext_resource type="AudioStream" uid="uid://dtjpv2b74g24m" path="res://assets/sfx/splash-small.wav" id="2_0wk8g"]
[ext_resource type="PackedScene" uid="uid://ba2mut58elwrh" path="res://assets/water-bomb.glb" id="2_v2imr"]
[ext_resource type="AudioStream" uid="uid://blgrl2wl05feq" path="res://assets/sfx/splash-small-quiet.wav" id="3_hgy7l"]
[ext_resource type="Shader" path="res://scenes/interactivity_outline.gdshader" id="3_vfl1p"]
[ext_resource type="Script" path="res://src/lib/item_component.gd" id="5_rpnf2"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_0ebrr"]
@ -26,20 +25,9 @@ properties/4/replication_mode = 2
properties/5/path = NodePath("SplashParticles:emitting")
properties/5/spawn = true
properties/5/replication_mode = 2
[sub_resource type="ShaderMaterial" id="ShaderMaterial_cpgfr"]
resource_local_to_scene = true
render_priority = 0
shader = ExtResource("3_vfl1p")
shader_parameter/color = Color(1, 1, 1, 0)
shader_parameter/size = 1.24
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dykfn"]
resource_local_to_scene = true
next_pass = SubResource("ShaderMaterial_cpgfr")
albedo_color = Color(0.0936238, 0.825356, 1, 1)
metallic = 0.8
roughness = 0.4
properties/6/path = NodePath(".:rotation")
properties/6/spawn = true
properties/6/replication_mode = 1
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v7dnr"]
albedo_color = Color(0, 1, 1, 1)
@ -74,8 +62,8 @@ body = NodePath("RigidBody3D")
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_0ebrr")
[node name="Model" parent="." instance=ExtResource("2_0lxuq")]
material_override = SubResource("StandardMaterial3D_dykfn")
[node name="Model" parent="." instance=ExtResource("2_v2imr")]
transform = Transform3D(-0.994881, 0, -0.101056, 0, 1, 0, 0.101056, 0, -0.994881, 0, 0, 0)
[node name="SplashParticles" type="GPUParticles3D" parent="."]
material_override = SubResource("StandardMaterial3D_v7dnr")