some juice work on the first person weapon
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=54 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
[gd_scene load_steps=52 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
||||
[ext_resource type="PackedScene" uid="uid://cf3rrgr1imvv4" path="res://scenes/path/path.tscn" id="2_6lejt"]
|
||||
@@ -17,11 +17,9 @@
|
||||
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle/mantle_system.tscn" id="8_qu4wy"]
|
||||
[ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://systems/inputs/base_mode/aim_pressed.tres" id="9_nob5r"]
|
||||
[ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://systems/inputs/base_mode/jump.tres" id="10_4u7i3"]
|
||||
[ext_resource type="Script" uid="uid://g8idirw62qe0" path="res://player_controller/Scripts/Bobbing.cs" id="10_7wk1w"]
|
||||
[ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://systems/inputs/base_mode/hit.tres" id="11_cresl"]
|
||||
[ext_resource type="PackedScene" uid="uid://0ysqmqphq6mq" path="res://systems/head/head_system.tscn" id="11_rxwoh"]
|
||||
[ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://systems/inputs/base_mode/dash.tres" id="12_34snm"]
|
||||
[ext_resource type="Script" uid="uid://b6k73aj5povgv" path="res://player_controller/Scripts/FieldOfView.cs" id="12_m2mxi"]
|
||||
[ext_resource type="Resource" uid="uid://55b0dsvioj08" path="res://systems/inputs/base_mode/jump_pressed.tres" id="13_nob5r"]
|
||||
[ext_resource type="Shape3D" uid="uid://keseacdcooot" path="res://player_controller/resources/PlayerShape.tres" id="13_r7i3q"]
|
||||
[ext_resource type="Script" uid="uid://b5nk6ntlps3x0" path="res://systems/inputs/input_system.gd" id="16_v31n3"]
|
||||
@@ -174,6 +172,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
|
||||
CameraInclineAcceleration = 20.0
|
||||
GroundedCameraIncline = 3.0
|
||||
SlidingJitterAmplitude = 0.2
|
||||
WeaponSway = 8.0
|
||||
WeaponLookRotation = 10.0
|
||||
WeaponAdjustmentSpeed = 1.0
|
||||
|
||||
[node name="MantleSystem" parent="HeadSystem" instance=ExtResource("8_qu4wy")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
|
||||
@@ -203,12 +204,6 @@ collision_mask = 256
|
||||
target_position = Vector3(0, -0.75, 0)
|
||||
collision_mask = 256
|
||||
|
||||
[node name="Bobbing" type="Node3D" parent="."]
|
||||
script = ExtResource("10_7wk1w")
|
||||
|
||||
[node name="FieldOfView" type="Node3D" parent="."]
|
||||
script = ExtResource("12_m2mxi")
|
||||
|
||||
[node name="HeadCollisionDetectors" type="Node3D" parent="."]
|
||||
visible = false
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
// Public stuff //
|
||||
///////////////////////////
|
||||
public HeadSystem HeadSystem;
|
||||
public Bobbing Bobbing;
|
||||
public FieldOfView FieldOfView;
|
||||
public StairsSystem StairsSystem;
|
||||
public MantleSystem MantleSystem;
|
||||
public DashSystem DashSystem;
|
||||
@@ -340,8 +338,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
// Camera stuff
|
||||
HeadSystem = GetNode<HeadSystem>("HeadSystem");
|
||||
Bobbing = GetNode<Bobbing>("Bobbing");
|
||||
FieldOfView = GetNode<FieldOfView>("FieldOfView");
|
||||
Camera3D camera = GetNode<Camera3D>("HeadSystem/CameraSmooth/Camera3D");
|
||||
Node3D cameraSmooth = GetNode<Node3D>("HeadSystem/CameraSmooth");
|
||||
|
||||
@@ -422,8 +418,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
// Camera stuff
|
||||
HeadSystem.Init();
|
||||
Bobbing.Init(camera);
|
||||
FieldOfView.Init(camera);
|
||||
|
||||
// Movement stuff
|
||||
// Getting universal setting from GODOT editor to be in sync
|
||||
@@ -811,8 +805,20 @@ public partial class PlayerController : CharacterBody3D,
|
||||
var lookSensitivity = _isUsingGamepad ? _lookSensitivityMultiplier : _mouseSensitivityMultiplier;
|
||||
|
||||
var wallHugContactPoint = _onWallRunning.Active ? _currentWallContactPoint : Vector3.Zero;
|
||||
var playerVelocity = GetGlobalMoveInput();
|
||||
HeadSystem.LookAround(delta, inputLookDir, playerVelocity, Velocity, wallHugContactPoint, lookSensitivity, isSliding: _groundSliding.Active);
|
||||
var moveInput = GetGlobalMoveInput();
|
||||
|
||||
var lookAroundInputs = new HeadSystem.CameraParameters(
|
||||
Delta: delta,
|
||||
LookDir: inputLookDir,
|
||||
PlayerInput: moveInput,
|
||||
PlayerVelocity:Velocity,
|
||||
WallContactPoint: wallHugContactPoint,
|
||||
SensitivitMultiplier: lookSensitivity,
|
||||
WithCameraJitter: _groundSliding.Active,
|
||||
WithCameraBobbing: _grounded.Active || _onWallRunning.Active,
|
||||
BobbingMultiplier: _headBobbingMultiplier,
|
||||
FovMultiplier: _fovChangeMultiplier);
|
||||
HeadSystem.LookAround(lookAroundInputs);
|
||||
}
|
||||
public void RotateWeaponWithPlayer()
|
||||
{
|
||||
@@ -822,28 +828,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
return Transform.Basis * HeadSystem.Transform.Basis * Vector3.Forward;
|
||||
}
|
||||
private void CameraModifications(float delta)
|
||||
{
|
||||
Bobbing.CameraBobbingParams cameraBobbingParams = new Bobbing.CameraBobbingParams
|
||||
{
|
||||
Delta = delta,
|
||||
IsOnFloorCustom = _grounded.Active || _onWallRunning.Active,
|
||||
Velocity = Velocity,
|
||||
SettingsMultiplier = _headBobbingMultiplier
|
||||
};
|
||||
Bobbing.PerformCameraBobbing(cameraBobbingParams);
|
||||
|
||||
FieldOfView.FovParameters fovParams = new FieldOfView.FovParameters
|
||||
{
|
||||
IsCrouchingHeight = false,
|
||||
Delta = delta,
|
||||
SprintSpeed = WalkSpeed,
|
||||
Velocity = Velocity,
|
||||
FOVMultiplier = _fovChangeMultiplier
|
||||
};
|
||||
FieldOfView.PerformFovAdjustment(fovParams);
|
||||
}
|
||||
|
||||
// Horizontal velocity computing
|
||||
public Vector3 ComputeHVelocity(float delta, float accelerationFactor, float decelerationFactor, Vector3? direction = null)
|
||||
{
|
||||
@@ -1718,7 +1702,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
if (_currentInputBufferFrames > 0) _currentInputBufferFrames -= 1;
|
||||
|
||||
LookAround(delta);
|
||||
CameraModifications((float) delta);
|
||||
MoveSlideAndHandleStairs((float) delta);
|
||||
MantleSystem.ProcessMantle(_grounded.Active);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user