waterpole improvements
This commit is contained in:
parent
9549acde6e
commit
aa6b9cb4aa
6 changed files with 40 additions and 16 deletions
19
assets/shaders/barber_shop.gdshader
Normal file
19
assets/shaders/barber_shop.gdshader
Normal file
|
@ -0,0 +1,19 @@
|
|||
shader_type spatial;
|
||||
render_mode specular_disabled, vertex_lighting;
|
||||
|
||||
uniform vec3 color_a : source_color = vec3(1.0);
|
||||
uniform vec3 color_b : source_color = vec3(0.0);
|
||||
uniform float stripe_count = 2.0;
|
||||
uniform float twist_factor = 1.0;
|
||||
uniform float speed = 0.5;
|
||||
|
||||
void vertex() {
|
||||
float world_height = (MODEL_MATRIX * vec4(VERTEX, 1.0)).y;
|
||||
UV.y = world_height - TIME * speed;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
float twisted_x = UV.x - (UV.y * twist_factor);
|
||||
float stripe = step(sin(twisted_x * stripe_count * TAU), 0.0);
|
||||
ALBEDO = mix(color_a, color_b, stripe);
|
||||
}
|
|
@ -163,8 +163,10 @@ func _start_winning() -> void:
|
|||
#region Pole Spinning
|
||||
var _attached_pole: WatermanPole = null
|
||||
var _pole_angle: float = 0.0
|
||||
var _pole_stored_speed: float = 0.0
|
||||
|
||||
func _start_pole_spin() -> void:
|
||||
_pole_stored_speed = flatten_vector(velocity).length()
|
||||
velocity = Vector3.ZERO
|
||||
var pole_xz = flatten_vector(_attached_pole.global_position)
|
||||
var self_xz = flatten_vector(global_position)
|
||||
|
@ -189,7 +191,7 @@ func _process_pole_spin(delta: float) -> void:
|
|||
|
||||
func _end_pole_spin() -> void:
|
||||
var pole_xz = flatten_vector(_attached_pole.global_position)
|
||||
var impulse = Vector3.FORWARD.rotated(Vector3.UP, _pole_angle) * _attached_pole.release_boost
|
||||
var impulse = Vector3.FORWARD.rotated(Vector3.UP, _pole_angle) * _pole_stored_speed
|
||||
velocity.x = impulse.x
|
||||
velocity.z = impulse.z
|
||||
#endregion
|
||||
|
|
|
@ -135,6 +135,7 @@ mesh = SubResource("CylinderMesh_b16dl")
|
|||
|
||||
[node name="CameraArm" type="SpringArm3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 0, 0)
|
||||
collision_mask = 8
|
||||
spring_length = 8.0
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="CameraArm"]
|
||||
|
@ -212,8 +213,8 @@ delay_in_seconds = "0.0"
|
|||
[connection signal="charge_canceled" from="." to="Sounds/ChargeCancel" method="play"]
|
||||
[connection signal="shot" from="." to="Sounds/Shoot" method="play"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Idle" to="." method="_apply_gravity"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_bounce_on_walls"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_apply_gravity"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_bounce_on_walls"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_slow_to_stop"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Charging" to="." method="_start_charge"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Charging" to="Sounds/ChargeStart" method="play"]
|
||||
|
|
|
@ -6,7 +6,6 @@ extends Node3D
|
|||
@export_range(-1,1,0.5,"or_less","or_greater","radians_as_degrees")
|
||||
var spin_speed: float
|
||||
@export var offset: float
|
||||
@export var release_boost: float
|
||||
|
||||
@export_group("Node References")
|
||||
@export var top: Node3D
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://13qlrib2dk36"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://13qlrib2dk36"]
|
||||
|
||||
[ext_resource type="Script" path="res://objects/waterman_pole.gd" id="1_8whes"]
|
||||
[ext_resource type="Shader" path="res://assets/shaders/barber_shop.gdshader" id="2_dukp0"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6xwjl"]
|
||||
shading_mode = 2
|
||||
specular_mode = 2
|
||||
albedo_color = Color(3.27289e-06, 0.685269, 0.929658, 1)
|
||||
metallic_specular = 0.0
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2dh7w"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("2_dukp0")
|
||||
shader_parameter/color_a = Color(0.792663, 0.606026, 0.896219, 1)
|
||||
shader_parameter/color_b = Color(0.106954, 0.441954, 1, 1)
|
||||
shader_parameter/stripe_count = 2.0
|
||||
shader_parameter/twist_factor = 0.75
|
||||
shader_parameter/speed = 0.5
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_nbwjg"]
|
||||
top_radius = 0.25
|
||||
|
@ -17,7 +21,7 @@ rings = 8
|
|||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_28fhu"]
|
||||
height = 1.0
|
||||
radius = 0.25
|
||||
radius = 0.125
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_o6xmv"]
|
||||
height = 1.0
|
||||
|
@ -25,11 +29,14 @@ radius = 0.4
|
|||
|
||||
[node name="WatermanPole" type="Node3D" node_paths=PackedStringArray("top")]
|
||||
script = ExtResource("1_8whes")
|
||||
rise_speed = 6.0
|
||||
spin_speed = 9.42478
|
||||
offset = 0.75
|
||||
top = NodePath("Top")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
[node name="PoleMesh" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||
material_override = SubResource("StandardMaterial3D_6xwjl")
|
||||
material_override = SubResource("ShaderMaterial_2dh7w")
|
||||
mesh = SubResource("CylinderMesh_nbwjg")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
||||
|
|
|
@ -76,7 +76,3 @@ transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107,
|
|||
|
||||
[node name="WatermanPole" parent="." instance=ExtResource("7_m8si3")]
|
||||
transform = Transform3D(1, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0)
|
||||
rise_speed = 8.0
|
||||
spin_speed = 12.5664
|
||||
offset = 1.0
|
||||
release_boost = 20.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue