WIP: Unknown changes

This commit is contained in:
Nikolai Rodionov 2025-03-16 20:49:48 +01:00
parent f344c22859
commit 77d37caeb2
Signed by: allanger
GPG Key ID: 09F8B434D0FDD99B
7 changed files with 66 additions and 3626 deletions

Binary file not shown.

View File

@ -26,7 +26,7 @@ ServerInstance="*res://src/server/server.tscn"
[display]
window/size/mode=3
window/size/mode=4
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
@ -90,6 +90,6 @@ previous_camera={
[physics]
3d/physics_engine="JoltPhysics3D"
3d/default_gravity=15.0
3d/default_gravity=20.0
2d/default_gravity=1200.0
common/physics_interpolation=true

View File

@ -3,12 +3,15 @@ class_name CameraMount extends Node3D
@export var camera_name: String
@export var input_camera: bool = true
@onready var camera: Camera3D = $Camera3D
var prev_rotation: Vector3
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if camera_name == null:
camera_name = str(name)
ClientConnectorInstance.register_camera(camera_name, input_camera, camera)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
prev_rotation = global_rotation
global_rotation = lerp(prev_rotation, Vector3(prev_rotation.x, prev_rotation.y, 0), 0.5)
pass

View File

@ -1,19 +1,26 @@
[gd_scene load_steps=4 format=3 uid="uid://w85pakfqbksh"]
[gd_scene load_steps=7 format=3 uid="uid://w85pakfqbksh"]
[ext_resource type="Texture2D" uid="uid://bv4un06wgrpxw" path="res://assets/textures/kenny_prototype/Dark/texture_05.png" id="1_ntrfg"]
[ext_resource type="PackedScene" uid="uid://b2ogo643mvror" path="res://src/scenes/player/player.tscn" id="2_hem5n"]
[ext_resource type="Texture2D" uid="uid://ygj7nmxbkb5u" path="res://assets/textures/kenny_prototype/Dark/texture_01.png" id="2_o7dmo"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_506q6"]
albedo_texture = ExtResource("1_ntrfg")
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_o7dmo"]
sky_top_color = Color(0.923722, 0.926536, 0.967073, 1)
sky_horizon_color = Color(0.745584, 0.649721, 0.316274, 1)
[sub_resource type="Sky" id="Sky_3k31k"]
sky_material = SubResource("ProceduralSkyMaterial_o7dmo")
process_mode = 1
[sub_resource type="Environment" id="Environment_35pe8"]
background_mode = 2
sky = SubResource("Sky_3k31k")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3k31k"]
albedo_texture = ExtResource("2_o7dmo")
uv1_scale = Vector3(5, 5, 5)
[node name="GymMap" type="Node3D"]
[node name="Floor" type="CSGBox3D" parent="."]
transform = Transform3D(0.699002, 0, -0.71512, 0, 1, 0, 0.71512, 0, 0.699002, 0, -0.5, 0)
material_override = SubResource("StandardMaterial3D_506q6")
use_collision = true
size = Vector3(100, 1, 100)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.0224081, 0.999749, 0, -0.999749, 0.0224081, 0, 24.4279, 0)
@ -24,3 +31,11 @@ transform = Transform3D(1, 0, 0, 0, 0.0224081, 0.999749, 0, -0.999749, 0.0224081
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 2.31299, 0, 0, 0, 2.66876, 0, 1.15303, -3.26361)
use_collision = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_35pe8")
[node name="Floor" type="CSGBox3D" parent="."]
use_collision = true
size = Vector3(100, 0.5, 100)
material = SubResource("StandardMaterial3D_3k31k")

View File

@ -1,34 +1,4 @@
extends Node3D
const SPEED = 5.0
const JUMP_VELOCITY = 4.5
var camera_sens: float = 0.002
@onready var player_camera: Node3D = $VisualsController/Camera/CameraMount
@onready var marker = $LookDirection
@onready var eye_marker: Marker3D = $EyeMarker
@onready var movement_contrller: Node3D = $MovementController
@onready var v_rotation: Node3D = $MovementController/VRotation
@onready var visual_controller: Node3D = $VisualsController
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
var look_dir = event.relative * 1
movement_contrller.rotation.y -= look_dir.x * camera_sens * 1.0
v_rotation.rotation.x = clamp(
v_rotation.rotation.x - look_dir.y * camera_sens * 1.0, -1.5, 1.5
)
if Input.is_action_pressed("shoot"):
$VisualsController/Model/Armature/Skeleton3D/ShootingModifier.shooting = true
else:
$VisualsController/Model/Armature/Skeleton3D/ShootingModifier.shooting = false
func _physics_process(delta: float) -> void:
visual_controller.global_rotation.y = lerp_angle(visual_controller.global_rotation.y, movement_contrller.global_rotation.y, 0.2)
pass
func _ready() -> void:
$VisualsController/Model/Armature/Skeleton3D/SkeletonIK3D.start()
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

File diff suppressed because one or more lines are too long

View File

@ -1,32 +1,37 @@
extends CharacterBody3D
@onready var animation_player = $"../VisualsController/Model/AnimationPlayer"
const SPEED = 8.0
const JUMP_VELOCITY = 7
var camera_sens: float = 0.005
@onready var h_rotation: Node3D = $"H-Rotation"
const SPEED = 5.0
const JUMP_VELOCITY = 4.5
var camera_sens: float = 0.002
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
var look_dir = event.relative * 1
rotation.y -= look_dir.x * camera_sens * 1.0
h_rotation.rotation.x = clamp(
h_rotation.rotation.x - look_dir.y * camera_sens * 1.0, -1.5, 1.5
)
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Handle jump.
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
animation_player.play("Walk-aim")
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
animation_player.pause()
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
# Handle jump.
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
move_and_slide()