gfolf2/src/equipment/balls/physics_ball/physics_ball.tscn

91 lines
2.9 KiB
Plaintext
Raw Normal View History

2024-11-19 21:52:04 -07:00
[gd_scene load_steps=9 format=3 uid="uid://dfttci386ohip"]
2024-11-03 10:07:21 -07:00
2024-11-17 14:07:28 -07:00
[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"]
2024-11-03 10:07:21 -07:00
[ext_resource type="Texture2D" uid="uid://ckhiq6rfjv63u" path="res://assets/textures/gfolfball/gfolfball.png" id="1_y3q5j"]
[ext_resource type="Texture2D" uid="uid://btntjs7mbdigu" path="res://assets/textures/gfolfball/gfolfball_normal.png" id="2_mx7l6"]
2024-11-03 10:07:21 -07:00
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xqofq"]
albedo_texture = ExtResource("1_y3q5j")
albedo_texture_force_srgb = true
metallic = 0.27
2024-11-03 10:07:21 -07:00
roughness = 0.67
normal_enabled = true
2024-11-03 10:07:21 -07:00
normal_scale = 0.2
normal_texture = ExtResource("2_mx7l6")
clearcoat_roughness = 0.0
2024-11-03 10:07:21 -07:00
uv1_scale = Vector3(3, 1.5, 3)
texture_filter = 4
2024-11-03 10:07:21 -07:00
[sub_resource type="SphereMesh" id="SphereMesh_y0d13"]
material = SubResource("StandardMaterial3D_xqofq")
radius = 0.05
height = 0.1
2024-11-02 19:05:49 -06:00
radial_segments = 6
rings = 6
[sub_resource type="SphereShape3D" id="SphereShape3D_0hvq6"]
radius = 0.05
2024-11-19 21:52:04 -07:00
[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)
2024-11-19 21:52:04 -07:00
const WIDTH := 4
@onready var physics_ball: GameBall = $\"..\"
func _process(_delta: float) -> void:
if visible:
queue_redraw()
2024-11-19 21:52:04 -07:00
func _draw() -> void:
if physics_ball._last_contact_normal != null:
2024-11-19 21:52:04 -07:00
var camera := get_viewport().get_camera_3d()
var start := camera.unproject_position(physics_ball.global_position)
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)
2024-11-19 21:52:04 -07:00
"
[node name="PhysicsBall" type="RigidBody3D"]
2024-11-02 19:05:49 -06:00
mass = 0.05
2024-11-12 20:03:05 -07:00
physics_material_override = ExtResource("1_l23pw")
2024-11-19 21:52:04 -07:00
freeze = true
2024-11-02 19:05:49 -06:00
continuous_cd = true
2024-11-12 18:16:30 -07:00
contact_monitor = true
2024-11-20 22:04:35 -07:00
max_contacts_reported = 3
2024-11-02 19:05:49 -06:00
linear_damp_mode = 1
2024-11-12 18:16:30 -07:00
angular_damp_mode = 1
2024-11-12 20:03:05 -07:00
angular_damp = 8.0
2024-11-11 11:39:12 -07:00
script = ExtResource("1_iwh2u")
2024-11-12 20:03:05 -07:00
iron_damping = 1e+07
[node name="BallMesh" type="MeshInstance3D" parent="."]
2024-11-03 10:07:21 -07:00
mesh = SubResource("SphereMesh_y0d13")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_0hvq6")
2024-11-19 21:52:04 -07:00
[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")
[connection signal="sleeping_state_changed" from="." to="." method="_on_sleeping_state_changed"]