Stabilize exported fishing rod attachment
This commit is contained in:
parent
d6cff0a23c
commit
6b7ef4c11b
3 changed files with 49 additions and 34 deletions
24
player/fishing_rod_attachment.tscn
Normal file
24
player/fishing_rod_attachment.tscn
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
[gd_scene load_steps=3 format=3]
|
||||||
|
|
||||||
|
[sub_resource type="CylinderMesh" id="FishingRodMesh"]
|
||||||
|
top_radius = 0.025
|
||||||
|
bottom_radius = 0.045
|
||||||
|
height = 1.2
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="FishingRodMaterial"]
|
||||||
|
albedo_color = Color(0.22, 0.12, 0.06, 1)
|
||||||
|
roughness = 0.8
|
||||||
|
|
||||||
|
[node name="FishingRodAttachment" type="BoneAttachment3D"]
|
||||||
|
bone_name = "hand.R"
|
||||||
|
|
||||||
|
[node name="FishingRod" type="Node3D" parent="."]
|
||||||
|
rotation = Vector3(-0.785398, -0.007863, 3.141593)
|
||||||
|
|
||||||
|
[node name="RodMesh" type="MeshInstance3D" parent="FishingRod"]
|
||||||
|
position = Vector3(0, 0.42, 0)
|
||||||
|
mesh = SubResource("FishingRodMesh")
|
||||||
|
material_override = SubResource("FishingRodMaterial")
|
||||||
|
|
||||||
|
[node name="FishingRodTip" type="Marker3D" parent="FishingRod"]
|
||||||
|
position = Vector3(0, 0.95, 0)
|
||||||
|
|
@ -18,6 +18,9 @@ const PlayerItemEffectsType = preload(
|
||||||
const PlayerCoolerCapacityType = preload(
|
const PlayerCoolerCapacityType = preload(
|
||||||
"res://progression/player_cooler_capacity.gd"
|
"res://progression/player_cooler_capacity.gd"
|
||||||
)
|
)
|
||||||
|
const FishingRodAttachmentScene = preload(
|
||||||
|
"res://player/fishing_rod_attachment.tscn"
|
||||||
|
)
|
||||||
|
|
||||||
const CHARACTER_IDLE_ANIMATION: StringName = &"idle"
|
const CHARACTER_IDLE_ANIMATION: StringName = &"idle"
|
||||||
const CHARACTER_WALKING_ANIMATION: StringName = &"walking"
|
const CHARACTER_WALKING_ANIMATION: StringName = &"walking"
|
||||||
|
|
@ -103,14 +106,6 @@ class ShowcaseCameraSnapshot:
|
||||||
@onready var item_effects: PlayerItemEffectsType = %ItemEffects
|
@onready var item_effects: PlayerItemEffectsType = %ItemEffects
|
||||||
@onready var cooler_capacity: PlayerCoolerCapacityType = %CoolerCapacity
|
@onready var cooler_capacity: PlayerCoolerCapacityType = %CoolerCapacity
|
||||||
@onready var _cast_origin: Marker3D = %CastOrigin
|
@onready var _cast_origin: Marker3D = %CastOrigin
|
||||||
@onready var _fishing_rod: Node3D = get_node(
|
|
||||||
"Visuals/CharacterRig/CharacterRig/Skeleton3D/"
|
|
||||||
+ "FishingRodAttachment/FishingRod"
|
|
||||||
) as Node3D
|
|
||||||
@onready var _fishing_rod_tip: Marker3D = get_node(
|
|
||||||
"Visuals/CharacterRig/CharacterRig/Skeleton3D/"
|
|
||||||
+ "FishingRodAttachment/FishingRod/FishingRodTip"
|
|
||||||
) as Marker3D
|
|
||||||
@onready var _catch_display: Node3D = %CatchDisplay
|
@onready var _catch_display: Node3D = %CatchDisplay
|
||||||
@onready var _catch_sprite: Sprite3D = %CatchSprite
|
@onready var _catch_sprite: Sprite3D = %CatchSprite
|
||||||
@onready var _held_fish_display: Node3D = %HeldFishDisplay
|
@onready var _held_fish_display: Node3D = %HeldFishDisplay
|
||||||
|
|
@ -151,14 +146,35 @@ var _network_target_visual_yaw: float = 0.0
|
||||||
var _network_snapshot_ready: bool = false
|
var _network_snapshot_ready: bool = false
|
||||||
var _character_animation_name: StringName = &""
|
var _character_animation_name: StringName = &""
|
||||||
var _sitting: bool = false
|
var _sitting: bool = false
|
||||||
|
var _fishing_rod: Node3D
|
||||||
|
var _fishing_rod_tip: Marker3D
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
_initialize_fishing_rod()
|
||||||
_target_zoom = clampf(_spring_arm.spring_length, minimum_zoom, maximum_zoom)
|
_target_zoom = clampf(_spring_arm.spring_length, minimum_zoom, maximum_zoom)
|
||||||
_spring_arm.spring_length = _target_zoom
|
_spring_arm.spring_length = _target_zoom
|
||||||
_camera.current = local_control_enabled
|
_camera.current = local_control_enabled
|
||||||
|
|
||||||
|
|
||||||
|
func _initialize_fishing_rod() -> void:
|
||||||
|
var skeleton := get_node_or_null(
|
||||||
|
"Visuals/CharacterRig/CharacterRig/Skeleton3D"
|
||||||
|
) as Skeleton3D
|
||||||
|
if skeleton == null:
|
||||||
|
push_error("Player character skeleton is unavailable.")
|
||||||
|
return
|
||||||
|
var attachment := FishingRodAttachmentScene.instantiate() as BoneAttachment3D
|
||||||
|
if attachment == null:
|
||||||
|
push_error("Fishing rod attachment could not be instantiated.")
|
||||||
|
return
|
||||||
|
skeleton.add_child(attachment)
|
||||||
|
_fishing_rod = attachment.get_node("FishingRod") as Node3D
|
||||||
|
_fishing_rod_tip = attachment.get_node(
|
||||||
|
"FishingRod/FishingRodTip"
|
||||||
|
) as Marker3D
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if _network_interpolation_enabled:
|
if _network_interpolation_enabled:
|
||||||
_update_network_interpolation(delta)
|
_update_network_interpolation(delta)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=18 format=3]
|
[gd_scene load_steps=16 format=3]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://player/player.gd" id="1_script"]
|
[ext_resource type="Script" path="res://player/player.gd" id="1_script"]
|
||||||
[ext_resource type="Script" path="res://inventory/fish_inventory.gd" id="2_inventory"]
|
[ext_resource type="Script" path="res://inventory/fish_inventory.gd" id="2_inventory"]
|
||||||
|
|
@ -18,15 +18,6 @@
|
||||||
radius = 0.45
|
radius = 0.45
|
||||||
height = 1.8
|
height = 1.8
|
||||||
|
|
||||||
[sub_resource type="CylinderMesh" id="FishingRodMesh"]
|
|
||||||
top_radius = 0.025
|
|
||||||
bottom_radius = 0.045
|
|
||||||
height = 1.2
|
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="FishingRodMaterial"]
|
|
||||||
albedo_color = Color(0.22, 0.12, 0.06, 1)
|
|
||||||
roughness = 0.8
|
|
||||||
|
|
||||||
[sub_resource type="QuadMesh" id="GroundShadowMesh"]
|
[sub_resource type="QuadMesh" id="GroundShadowMesh"]
|
||||||
material = ExtResource("12_blob_shadow")
|
material = ExtResource("12_blob_shadow")
|
||||||
size = Vector2(1.15, 0.72)
|
size = Vector2(1.15, 0.72)
|
||||||
|
|
@ -68,22 +59,6 @@ rotation_degrees = Vector3(0, 180, 0)
|
||||||
[node name="AnimationPlayer" parent="Visuals/CharacterRig"]
|
[node name="AnimationPlayer" parent="Visuals/CharacterRig"]
|
||||||
autoplay = "idle"
|
autoplay = "idle"
|
||||||
|
|
||||||
[node name="FishingRodAttachment" type="BoneAttachment3D" parent="Visuals/CharacterRig/CharacterRig/Skeleton3D"]
|
|
||||||
bone_name = "hand.R"
|
|
||||||
|
|
||||||
[node name="FishingRod" type="Node3D" parent="Visuals/CharacterRig/CharacterRig/Skeleton3D/FishingRodAttachment"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
rotation = Vector3(-0.785398, -0.007863, 3.141593)
|
|
||||||
|
|
||||||
[node name="RodMesh" type="MeshInstance3D" parent="Visuals/CharacterRig/CharacterRig/Skeleton3D/FishingRodAttachment/FishingRod"]
|
|
||||||
position = Vector3(0, 0.42, 0)
|
|
||||||
mesh = SubResource("FishingRodMesh")
|
|
||||||
material_override = SubResource("FishingRodMaterial")
|
|
||||||
|
|
||||||
[node name="FishingRodTip" type="Marker3D" parent="Visuals/CharacterRig/CharacterRig/Skeleton3D/FishingRodAttachment/FishingRod"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
position = Vector3(0, 0.95, 0)
|
|
||||||
|
|
||||||
[node name="CastOrigin" type="Marker3D" parent="."]
|
[node name="CastOrigin" type="Marker3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
position = Vector3(0, 0.9, 0)
|
position = Vector3(0, 0.9, 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue