add proper water bomb model

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

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")