Compare commits

...

3 Commits

24 changed files with 290 additions and 19 deletions

BIN
blends/grape.blend (Stored with Git LFS) Normal file

Binary file not shown.

BIN
blends/small_room.blend (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
godot/audio/charge.wav Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://ckhf7ksthi053"
path="res://.godot/imported/charge.wav-9ea0e7ab134da578b6f69151780ec24f.sample"
[deps]
source_file="res://audio/charge.wav"
dest_files=["res://.godot/imported/charge.wav-9ea0e7ab134da578b6f69151780ec24f.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -4,19 +4,36 @@ extends Node3D
@export var initial_target: Node3D @export var initial_target: Node3D
var target: Targetable = null var target: Targetable = null
@export var sensitivity := 0.01 @export var sensitivity := 0.01
@export var charge_time := 2
func _ready(): func _ready():
set_target(initial_target) set_target(initial_target)
func _input(event): func get_charge():
if event is InputEventMouseMotion: return %radial_ui.charge_amount
rotate_view(event.relative*sensitivity)
func _input(event):
if event is InputEventMouseMotion and MouseControl.mouse_is_locked() and get_charge() == 0.0:
rotate_view(event.relative*sensitivity)
if event.is_action("charge"):
charge(event.get_action_strength("charge"))
func _process(_delta): func _process(_delta):
transform.origin = target.global_position transform.origin = target.global_position
camera.global_position = %camera_spot.global_position camera.global_position = %camera_spot.global_position
camera.look_at(target.global_position) camera.look_at(target.global_position)
var charge_tween: Tween = null
func charge(amount: float):
if charge_tween != null:
charge_tween.kill()
if amount == 0.0:
%radial_ui.set_charge(0.0)
$AudioStreamPlayer.stop()
return
charge_tween = create_tween()
charge_tween.tween_method(%radial_ui.set_charge, 0.0, 1.0, charge_time)
$AudioStreamPlayer.play()
func rotate_view(amount: Vector2): func rotate_view(amount: Vector2):
rotate_y(-amount.x) rotate_y(-amount.x)
%rotate_helper.rotate_z(amount.y) %rotate_helper.rotate_z(amount.y)

View File

@ -1,6 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://drmb4sitb74fx"] [gd_scene load_steps=4 format=3 uid="uid://drmb4sitb74fx"]
[ext_resource type="Script" path="res://control_scheme/controller.gd" id="1_h3pjb"] [ext_resource type="Script" path="res://control_scheme/controller.gd" id="1_h3pjb"]
[ext_resource type="PackedScene" uid="uid://p2n48c8st55d" path="res://control_scheme/radial_ui.tscn" id="2_qidcb"]
[ext_resource type="AudioStream" uid="uid://ckhf7ksthi053" path="res://audio/charge.wav" id="3_exgm6"]
[node name="controller" type="Node3D"] [node name="controller" type="Node3D"]
top_level = true top_level = true
@ -12,3 +14,9 @@ unique_name_in_owner = true
[node name="camera_spot" type="Marker3D" parent="rotate_helper"] [node name="camera_spot" type="Marker3D" parent="rotate_helper"]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
[node name="radial_ui" parent="." instance=ExtResource("2_qidcb")]
unique_name_in_owner = true
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_exgm6")

View File

@ -28,9 +28,9 @@ func change_all_materials(mesh: MeshInstance3D):
layer0.next_pass = layer1 layer0.next_pass = layer1
layer1.next_pass = layer2 layer1.next_pass = layer2
layer0.render_priority = 0 layer0.render_priority = 10
layer1.render_priority = 1 layer1.render_priority = 20
layer2.render_priority = 2 layer2.render_priority = 30

View File

@ -0,0 +1,12 @@
extends Node3D
func _ready():
set_charge(0.0)
var charge_amount: float = 0.0
func set_charge(amount: float):
charge_amount = amount
var mat: ShaderMaterial = $MeshInstance3D.get_active_material(0)
mat.set_shader_parameter("charge", amount)

View File

@ -0,0 +1,39 @@
// NOTE: Shader automatically converted from Godot Engine 4.1.3.stable.mono's StandardMaterial3D.
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_disabled,unshaded,shadows_disabled,ambient_light_disabled, depth_test_disabled;
uniform float grow;
uniform sampler2D colors : source_color, repeat_disable;
uniform float charge = 1.0;
#include "res://shaders/noise.gdshaderinc"
void vertex() {
// Billboarding
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], INV_VIEW_MATRIX[1], INV_VIEW_MATRIX[2], MODEL_MATRIX[3]);
MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);
VERTEX+=NORMAL*grow;
float speed = pow(2.0, ((charge+.4)*5.0));
float dy = sin(speed*.7) * 0.005;
float dx = sin(speed) * 0.005;
VERTEX.y += dy;
VERTEX.x += dx;
}
void fragment() {
float where = distance(UV, vec2(0.5))*2.0;
if (where >= charge) {
discard;
}
vec2 buv = floor(UV * 350.0);
int bx = int(buv.x);
int by = int(buv.y);
int amount = 2;
if ((bx % amount == 0) || (by % amount == 0)) {
discard;
}
ALBEDO = texture(colors, vec2(where)).rgb;
}

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=4 format=3 uid="uid://p2n48c8st55d"]
[ext_resource type="Script" path="res://control_scheme/radial_ui.gd" id="1_0qwj1"]
[ext_resource type="Material" uid="uid://cybyibjbyyok1" path="res://control_scheme/radial_ui_material.tres" id="2_go05o"]
[sub_resource type="QuadMesh" id="QuadMesh_sogra"]
[node name="radial_ui" type="Node3D"]
script = ExtResource("1_0qwj1")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
material_override = ExtResource("2_go05o")
mesh = SubResource("QuadMesh_sogra")

View File

@ -0,0 +1,18 @@
[gd_resource type="ShaderMaterial" load_steps=4 format=3 uid="uid://cybyibjbyyok1"]
[ext_resource type="Shader" path="res://control_scheme/radial_ui.gdshader" id="1_hmfvm"]
[sub_resource type="Gradient" id="Gradient_l7u12"]
interpolation_mode = 1
offsets = PackedFloat32Array(0.00328947, 0.347039, 0.506579, 0.694079, 0.848684)
colors = PackedColorArray(0.266667, 0.215686, 0.258824, 1, 0.517647, 0.423529, 0.356863, 1, 0.807843, 0.627451, 0.494118, 1, 0.929412, 0.85098, 0.639216, 1, 0.886275, 0.909804, 0.752941, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_8vk7x"]
gradient = SubResource("Gradient_l7u12")
[resource]
render_priority = 5
shader = ExtResource("1_hmfvm")
shader_parameter/grow = 0.01
shader_parameter/charge = 0.0
shader_parameter/colors = SubResource("GradientTexture1D_8vk7x")

BIN
godot/grape.glb (Stored with Git LFS) Normal file

Binary file not shown.

40
godot/grape.glb.import Normal file
View File

@ -0,0 +1,40 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bsge8trc5uwb0"
path="res://.godot/imported/grape.glb-590b932d26d4103b5968cc4125e7a03e.scn"
[deps]
source_file="res://grape.glb"
dest_files=["res://.godot/imported/grape.glb-590b932d26d4103b5968cc4125e7a03e.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="res://physics/import_billiard.gd"
_subresources={
"nodes": {
"PATH:grape2": {
"generate/physics": true,
"physics/body_type": 1,
"physics/shape_type": 1
}
}
}
gltf/embedded_image_handling=1

23
godot/mouse_control.gd Normal file
View File

@ -0,0 +1,23 @@
extends Node
func lock_mouse():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func unlock_mouse():
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
func toggle_mouse_lock():
if mouse_is_locked():
unlock_mouse()
else:
lock_mouse()
func mouse_is_locked():
return Input.mouse_mode == Input.MOUSE_MODE_CAPTURED
func _input(event):
if event.is_action("charge") and Input.mouse_mode != Input.MOUSE_MODE_CAPTURED:
lock_mouse()
get_viewport().set_input_as_handled()
if event.is_action("ui_cancel"):
unlock_mouse()

View File

@ -0,0 +1 @@
extends RigidBody3D

View File

@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://cpj2gefpjwogk"]
[ext_resource type="Script" path="res://physics/billiard.gd" id="1_a0fke"]
[ext_resource type="PackedScene" uid="uid://cbp8c4kpmr0hk" path="res://control_scheme/is_targetable.tscn" id="2_yrk4o"]
[node name="billiard" type="RigidBody3D"]
script = ExtResource("1_a0fke")
[node name="is_targetable" parent="." instance=ExtResource("2_yrk4o")]

5
godot/physics/grape.tscn Normal file
View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3 uid="uid://c43pr474qofhl"]
[ext_resource type="PackedScene" uid="uid://bsge8trc5uwb0" path="res://grape.glb" id="1_jlfas"]
[node name="grape" instance=ExtResource("1_jlfas")]

View File

@ -0,0 +1,24 @@
@tool
extends EditorScenePostImport
func _post_import(scene: Node) -> Object:
if scene.get_child_count(true) != 1:
push_error("Ruh oh! 342808")
return null
var new_root: Node = scene.get_child(0)
var billiard: Node = preload("billiard.tscn").instantiate()
billiard.name = scene.name
take_children(new_root, billiard)
take_ownership(billiard, billiard)
return billiard
func take_children(src: Node, dest: Node):
for child in src.get_children(true):
src.remove_child(child)
dest.add_child(child)
func take_ownership(node: Node, owner: Node):
for child in node.get_children(true):
child.owner = owner
take_ownership(child, owner)

View File

@ -19,6 +19,7 @@ config/icon="res://icon.svg"
ControllerEventBus="*res://controller_event_bus.gd" ControllerEventBus="*res://controller_event_bus.gd"
TAS_System="*res://TAS_system/TAS_System.tscn" TAS_System="*res://TAS_system/TAS_System.tscn"
MouseControl="*res://mouse_control.gd"
[dotnet] [dotnet]
@ -27,3 +28,17 @@ project/assembly_name="Hurrmmm"
[filesystem] [filesystem]
import/blender/enabled=false import/blender/enabled=false
[input]
ui_cancel={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
charge={
"deadzone": 0.0,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}

BIN
godot/small_room.glb (Stored with Git LFS)

Binary file not shown.

View File

@ -28,5 +28,16 @@ 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={
"nodes": {
"PATH:room": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:table": {
"generate/physics": true,
"physics/shape_type": 2
}
}
}
gltf/embedded_image_handling=1 gltf/embedded_image_handling=1

View File

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://bua7f25rpewkp" path="res://small_room.glb" id="1_2ticn"] [ext_resource type="PackedScene" uid="uid://bua7f25rpewkp" path="res://small_room.glb" id="1_2ticn"]
[ext_resource type="PackedScene" uid="uid://drmb4sitb74fx" path="res://control_scheme/controller.tscn" id="2_dcvuq"] [ext_resource type="PackedScene" uid="uid://drmb4sitb74fx" path="res://control_scheme/controller.tscn" id="2_dcvuq"]
[ext_resource type="PackedScene" uid="uid://cbp8c4kpmr0hk" path="res://control_scheme/is_targetable.tscn" id="2_y2131"] [ext_resource type="PackedScene" uid="uid://c43pr474qofhl" path="res://physics/grape.tscn" id="3_gijly"]
[sub_resource type="Environment" id="Environment_f0m14"] [sub_resource type="Environment" id="Environment_f0m14"]
ambient_light_source = 2 ambient_light_source = 2
@ -11,16 +11,22 @@ ambient_light_energy = 0.5
[node name="small_room" instance=ExtResource("1_2ticn")] [node name="small_room" instance=ExtResource("1_2ticn")]
[node name="is_targetable" parent="grape" index="0" instance=ExtResource("2_y2131")] [node name="WorldEnvironment" type="WorldEnvironment" parent="." index="2"]
[node name="WorldEnvironment" type="WorldEnvironment" parent="." index="3"]
environment = SubResource("Environment_f0m14") environment = SubResource("Environment_f0m14")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment" index="0"] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment" index="0"]
transform = Transform3D(1, 0, 0, 0, 0.933762, 0.357895, 0, -0.357895, 0.933762, 0, 1.43864, 1.81738) transform = Transform3D(1, 0, 0, 0, 0.933762, 0.357895, 0, -0.357895, 0.933762, 0, 1.43864, 1.81738)
[node name="controller" parent="." index="4" node_paths=PackedStringArray("camera", "initial_target") instance=ExtResource("2_dcvuq")] [node name="controller" parent="." index="3" node_paths=PackedStringArray("camera", "initial_target") instance=ExtResource("2_dcvuq")]
camera = NodePath("Camera3D") camera = NodePath("Camera3D")
initial_target = NodePath("../grape") initial_target = NodePath("../grape")
[node name="Camera3D" type="Camera3D" parent="controller" index="1"] [node name="Camera3D" type="Camera3D" parent="controller" index="1"]
[node name="billiard" parent="." index="4" instance=ExtResource("3_gijly")]
[node name="grape" parent="." index="5" instance=ExtResource("3_gijly")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.56762, 0.385236)
[node name="grape2" parent="." index="6" instance=ExtResource("3_gijly")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.60495, 0)