generated from krampus/template-godot4
203 lines
7.2 KiB
Plaintext
203 lines
7.2 KiB
Plaintext
[gd_scene load_steps=22 format=3 uid="uid://dfttci386ohip"]
|
|
|
|
[ext_resource type="Script" path="res://src/equipment/balls/physics_ball/game_ball.gd" id="1_iwh2u"]
|
|
[ext_resource type="PhysicsMaterial" uid="uid://3bih72l068ic" path="res://src/equipment/balls/physics_ball/normal_physics.tres" id="1_l23pw"]
|
|
[ext_resource type="Material" uid="uid://dpsmjlhjpc7vs" path="res://assets/materials/basic_ball_material.tres" id="3_rc7m1"]
|
|
[ext_resource type="Script" path="res://src/equipment/balls/physics_ball/ball_sfx.gd" id="5_bhshl"]
|
|
[ext_resource type="AudioStream" uid="uid://cayyndwmxua5x" path="res://assets/sound/sfx/ball/grass2.wav" id="7_l22cv"]
|
|
[ext_resource type="AudioStream" uid="uid://orisjdcj3mes" path="res://assets/sound/sfx/ball/concrete3.wav" id="7_t2ak2"]
|
|
[ext_resource type="AudioStream" uid="uid://o4whyv43rr1u" path="res://assets/sound/sfx/ball/concrete4.wav" id="8_0anjl"]
|
|
[ext_resource type="AudioStream" uid="uid://3csnnhxndt67" path="res://assets/sound/sfx/ball/concrete5.wav" id="9_p0lmw"]
|
|
[ext_resource type="AudioStream" uid="uid://bbbp6wrkuhkek" path="res://assets/sound/sfx/ball/sand1.wav" id="10_b64mx"]
|
|
[ext_resource type="AudioStream" uid="uid://b5xx5t050i4p" path="res://assets/sound/sfx/ball/sand2.wav" id="11_ed8je"]
|
|
[ext_resource type="Script" path="res://src/equipment/balls/physics_ball/ball_particle_effects.gd" id="12_7krl6"]
|
|
[ext_resource type="Texture2D" uid="uid://c47bkx508biqr" path="res://assets/sprites/particles/plasma.png" id="12_guipt"]
|
|
|
|
[sub_resource type="SphereMesh" id="SphereMesh_y0d13"]
|
|
material = ExtResource("3_rc7m1")
|
|
radius = 0.05
|
|
height = 0.1
|
|
radial_segments = 6
|
|
rings = 6
|
|
|
|
[sub_resource type="SphereShape3D" id="SphereShape3D_0hvq6"]
|
|
radius = 0.05
|
|
|
|
[sub_resource type="GDScript" id="GDScript_p4v7o"]
|
|
resource_name = "debug_draw"
|
|
script/source = "extends Control
|
|
|
|
const COLOR_X := Color(1, 0, 0)
|
|
const COLOR_Y := Color(0, 1, 0)
|
|
const COLOR_Z := Color(0, 0, 1)
|
|
const COLOR_MAGNUS := Color.CYAN
|
|
const MAGNUS_SCALE := 3
|
|
const WIDTH := 4
|
|
|
|
@export var draw_reoriented_basis := true
|
|
@export var draw_magnus_effect := true
|
|
@export var draw_gravity_basis := true
|
|
|
|
@onready var physics_ball: GameBall = $\"..\"
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
if visible:
|
|
queue_redraw()
|
|
|
|
|
|
func _draw() -> void:
|
|
var camera := get_viewport().get_camera_3d()
|
|
var start := camera.unproject_position(physics_ball.global_position)
|
|
if draw_reoriented_basis and physics_ball._last_contact_normal != null:
|
|
var basis := physics_ball.get_reoriented_basis()
|
|
var end_x := camera.unproject_position(physics_ball.global_position + basis.x)
|
|
var end_y := camera.unproject_position(physics_ball.global_position + basis.y)
|
|
var end_z := camera.unproject_position(physics_ball.global_position + basis.z)
|
|
draw_line(start, end_x, COLOR_X, WIDTH)
|
|
draw_line(start, end_y, COLOR_Y, WIDTH)
|
|
draw_line(start, end_z, COLOR_Z, WIDTH)
|
|
|
|
if draw_magnus_effect:
|
|
var end := camera.unproject_position(physics_ball.global_position + physics_ball._magnus_force() * MAGNUS_SCALE)
|
|
draw_line(start, end, COLOR_MAGNUS, WIDTH)
|
|
|
|
if draw_gravity_basis:
|
|
var orbital: Node3D = camera.get_parent_node_3d().get_parent_node_3d().get_parent_node_3d()
|
|
var up := -physics_ball.current_gravity.normalized()
|
|
var right := up.cross(orbital.global_basis.z).normalized()
|
|
var forward := right.cross(up).normalized()
|
|
|
|
var end_x := camera.unproject_position(physics_ball.global_position + right)
|
|
var end_y := camera.unproject_position(physics_ball.global_position + up)
|
|
var end_z := camera.unproject_position(physics_ball.global_position + forward)
|
|
draw_line(start, end_x, COLOR_X, WIDTH)
|
|
draw_line(start, end_y, COLOR_Y, WIDTH)
|
|
draw_line(start, end_z, COLOR_Z, WIDTH)
|
|
"
|
|
|
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_gc38m"]
|
|
playback_mode = 1
|
|
random_pitch = 1.1
|
|
streams_count = 1
|
|
stream_0/stream = ExtResource("7_l22cv")
|
|
|
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_tg0n0"]
|
|
random_pitch = 1.1
|
|
streams_count = 3
|
|
stream_0/stream = ExtResource("7_t2ak2")
|
|
stream_1/stream = ExtResource("8_0anjl")
|
|
stream_2/stream = ExtResource("9_p0lmw")
|
|
|
|
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_uu1f8"]
|
|
playback_mode = 1
|
|
streams_count = 2
|
|
stream_0/stream = ExtResource("10_b64mx")
|
|
stream_1/stream = ExtResource("11_ed8je")
|
|
|
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_mwiw1"]
|
|
angle_min = -720.0
|
|
angle_max = 720.0
|
|
spread = 20.0
|
|
initial_velocity_min = 1.0
|
|
initial_velocity_max = 3.0
|
|
gravity = Vector3(0, -3, 0)
|
|
scale_min = 0.0
|
|
hue_variation_min = -0.02
|
|
hue_variation_max = -2.23517e-08
|
|
|
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v1i8b"]
|
|
transparency = 1
|
|
vertex_color_use_as_albedo = true
|
|
albedo_color = Color(0.78, 0.70928, 0.5304, 1)
|
|
albedo_texture = ExtResource("12_guipt")
|
|
texture_filter = 4
|
|
billboard_mode = 3
|
|
billboard_keep_scale = true
|
|
particles_anim_h_frames = 1
|
|
particles_anim_v_frames = 1
|
|
particles_anim_loop = false
|
|
|
|
[sub_resource type="QuadMesh" id="QuadMesh_xkteo"]
|
|
material = SubResource("StandardMaterial3D_v1i8b")
|
|
size = Vector2(0.2, 0.2)
|
|
|
|
[node name="PhysicsBall" type="RigidBody3D"]
|
|
mass = 0.05
|
|
physics_material_override = ExtResource("1_l23pw")
|
|
freeze = true
|
|
continuous_cd = true
|
|
contact_monitor = true
|
|
max_contacts_reported = 3
|
|
linear_damp_mode = 1
|
|
angular_damp_mode = 1
|
|
angular_damp = 8.0
|
|
script = ExtResource("1_iwh2u")
|
|
|
|
[node name="BallMesh" type="MeshInstance3D" parent="."]
|
|
mesh = SubResource("SphereMesh_y0d13")
|
|
|
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
|
shape = SubResource("SphereShape3D_0hvq6")
|
|
|
|
[node name="DebugDraw" type="Control" parent="."]
|
|
unique_name_in_owner = true
|
|
visible = false
|
|
layout_mode = 3
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
script = SubResource("GDScript_p4v7o")
|
|
draw_reoriented_basis = false
|
|
draw_magnus_effect = false
|
|
|
|
[node name="SFX" type="Node3D" parent="."]
|
|
unique_name_in_owner = true
|
|
script = ExtResource("5_bhshl")
|
|
|
|
[node name="GrassSFXPlayer" type="AudioStreamPlayer3D" parent="SFX"]
|
|
unique_name_in_owner = true
|
|
stream = SubResource("AudioStreamRandomizer_gc38m")
|
|
unit_size = 40.0
|
|
bus = &"SFX"
|
|
|
|
[node name="ConcreteSFXPlayer" type="AudioStreamPlayer3D" parent="SFX"]
|
|
unique_name_in_owner = true
|
|
stream = SubResource("AudioStreamRandomizer_tg0n0")
|
|
unit_size = 40.0
|
|
bus = &"SFX"
|
|
|
|
[node name="SandSFXPlayer" type="AudioStreamPlayer3D" parent="SFX"]
|
|
unique_name_in_owner = true
|
|
stream = SubResource("AudioStreamRandomizer_uu1f8")
|
|
unit_size = 40.0
|
|
max_db = 0.0
|
|
bus = &"SFX"
|
|
|
|
[node name="ManualSleepTimer" type="Timer" parent="."]
|
|
unique_name_in_owner = true
|
|
one_shot = true
|
|
|
|
[node name="AbilityCooldown" type="Timer" parent="."]
|
|
unique_name_in_owner = true
|
|
one_shot = true
|
|
|
|
[node name="ParticleEffects" type="Node3D" parent="."]
|
|
unique_name_in_owner = true
|
|
script = ExtResource("12_7krl6")
|
|
|
|
[node name="SandParticles" type="GPUParticles3D" parent="ParticleEffects"]
|
|
unique_name_in_owner = true
|
|
emitting = false
|
|
amount = 24
|
|
one_shot = true
|
|
explosiveness = 0.9
|
|
process_material = SubResource("ParticleProcessMaterial_mwiw1")
|
|
draw_pass_1 = SubResource("QuadMesh_xkteo")
|
|
|
|
[connection signal="body_entered" from="." to="." method="_on_collision"]
|
|
[connection signal="sleeping_state_changed" from="." to="." method="_on_sleeping_state_changed"]
|
|
[connection signal="timeout" from="ManualSleepTimer" to="." method="_fire_sleep_signal"]
|