Персонаж: модель киберниндзя со скелетом вместо капсул

- player/character/character.glb: 752 треугольника, 17 костей, 14 анимаций
  (idle, walk, run, crouch, slide, jump, fall, air_jump, dash, wallrun L/R,
  mantle, death); ноги на IK, исходник и скрипт сборки в Blender models
- Ghost: выбор анимации по флагам и скорости, подгонка speed_scale,
  голова повторяет взгляд, свечение красится в цвет игрока от его id
- Net: флаги FLAG_WALL_RIGHT и FLAG_AIR (RPC не менялись, сервер
  перевыкладывать не нужно)
- Игрок: капсула в player.tscn заменена моделью, спрятанной от своей камеры
- Модель в ghost.gd грузится через load, чтобы не ломать сервер без неё

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WxZo3ekR5m1af437Qzqwc1
This commit is contained in:
2026-10-28 13:11:23 +05:00
co-authored by Claude Sonnet 5.5
parent ace7ed5c84
commit b8282b1438
7 changed files with 186 additions and 47 deletions
Binary file not shown.
+45
View File
@@ -0,0 +1,45 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://d1vpt63d58k7j"
path="res://.godot/imported/character.glb-1a3f83084714c6a7099112be703c2a9c.scn"
[deps]
source_file="res://player/character/character.glb"
dest_files=["res://.godot/imported/character.glb-1a3f83084714c6a7099112be703c2a9c.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
mesh_library/use_node_names_as_mesh_names=false
array_mesh/deduplicate_surfaces=true
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
gltf/naming_version=2
gltf/embedded_image_handling=1
gltf/texture_map_mode=1
+9 -1
View File
@@ -196,6 +196,11 @@ func _ready() -> void:
head_base_pos = head.position
base_fov = head.fov
# Тело видно в редакторе и отбрасывает тень, но своя камера его не рисует (слой 2)
for mi: MeshInstance3D in $Model.find_children("*", "MeshInstance3D", true, false):
mi.layers = 2
head.cull_mask = 0xFFFFF & ~2
# Чтобы при спуске по ступенькам персонаж «прилипал» к полу, а не летел по воздуху
floor_snap_length = STEP_HEIGHT
@@ -251,9 +256,12 @@ func _unhandled_input(event: InputEvent) -> void:
func get_net_flags() -> int:
var flags := 0
if is_sliding or is_crouching: flags |= Net.FLAG_SLIDING # У призрака присед выглядит как сплюснутая капсула
if is_wallrunning: flags |= Net.FLAG_WALLRUN
if is_wallrunning:
flags |= Net.FLAG_WALLRUN
if wall_side > 0.0: flags |= Net.FLAG_WALL_RIGHT
if is_dashing: flags |= Net.FLAG_DASH
if is_mantling: flags |= Net.FLAG_MANTLE
if not is_on_floor() and not is_wallrunning and not is_mantling: flags |= Net.FLAG_AIR
return flags
func _get_input_dir() -> Vector2:
+3 -6
View File
@@ -1,15 +1,12 @@
[gd_scene format=3 uid="uid://c3efk6k8xnf57"]
[ext_resource type="Script" uid="uid://c22hclit1affa" path="res://player/player.gd" id="1_iwpo4"]
[ext_resource type="PackedScene" uid="uid://d1vpt63d58k7j" path="res://player/character/character.glb" id="2_model"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_h8axm"]
radius = 0.35205078
height = 2.3198242
[sub_resource type="CapsuleMesh" id="CapsuleMesh_bcw3a"]
radius = 0.34472656
height = 2.3242188
[node name="CharacterBody3D" type="CharacterBody3D" unique_id=365865796]
script = ExtResource("1_iwpo4")
@@ -21,5 +18,5 @@ debug_color = Color(0, 0.6, 0.69803923, 1)
transform = Transform3D(1, 0, -1.7484555e-07, 0, 1, 0, 1.7484555e-07, 0, 1, 0, 0.9, 0)
fov = 59.9
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=81801455]
mesh = SubResource("CapsuleMesh_bcw3a")
[node name="Model" parent="." unique_id=81801455 instance=ExtResource("2_model")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.16, 0)