going/project/objects/player.tscn

54 lines
1.8 KiB
Plaintext

[gd_scene load_steps=4 format=3 uid="uid://dcgsrdacswacl"]
[ext_resource type="PackedScene" uid="uid://cl7a4q5m73vlw" path="res://models/player/character.blend" id="1_eqqp1"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"]
radius = 0.339355
height = 2.15448
[sub_resource type="GDScript" id="GDScript_eqqp1"]
script/source = "extends Camera3D
@export var dist : float = 2.0
@export var pivot_height : float = 1.0
@export var look_target_height : float = 1.0
func _ready():
self.top_level = true
func _process(_delta):
var target : Vector3 = get_parent().global_position + Vector3(0.0, pivot_height, 0.0)
var diff := self.global_position - target
if abs(diff).x + abs(diff.z) > 0.1:
self.look_at_from_position(target + diff.normalized() * dist, get_parent().global_position + Vector3(0.0, look_target_height, 0.0))
else:
self.global_position = target + diff.normalized() * dist
"
[node name="Player" type="PlayerBody"]
physics_interpolation_mode = 1
collision_mask = 3
wall_min_slide_angle = 0.785398
floor_max_angle = 0.460767
floor_snap_length = 0.35
acceleration = 10.0
target_speed = 25.0
[node name="PlayerStateMachine" type="PlayerStateMachine" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.05124, 0)
shape = SubResource("CapsuleShape3D_bxedw")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(-1, -6.18173e-08, -6.18173e-08, -6.71313e-08, 0.99594, 0.0900246, 5.60012e-08, 0.0900246, -0.99594, 3.76484e-07, 1.43409, -2.96511)
fov = 100.0
script = SubResource("GDScript_eqqp1")
dist = 1.75
pivot_height = 2.0
look_target_height = 1.5
[node name="character" parent="." instance=ExtResource("1_eqqp1")]
unique_name_in_owner = true
[editable path="character"]