some shader work and improved mantle feel
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@
|
||||
.import/
|
||||
|
||||
/builds
|
||||
/communication
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
@@ -2588,6 +2588,7 @@ shape = SubResource("ConcavePolygonShape3D_wkikw")
|
||||
|
||||
[node name="Cube_174" parent="." index="174"]
|
||||
material_override = ExtResource("5_2eqlu")
|
||||
cast_shadow = 2
|
||||
|
||||
[node name="Cube_174_col" type="StaticBody3D" parent="Cube_174" index="0"]
|
||||
collision_layer = 3
|
||||
@@ -2608,6 +2609,7 @@ shape = SubResource("ConcavePolygonShape3D_4au7w")
|
||||
|
||||
[node name="Cube_176" parent="." index="176"]
|
||||
material_override = ExtResource("4_7r3kr")
|
||||
cast_shadow = 2
|
||||
|
||||
[node name="Cube_176_col" type="StaticBody3D" parent="Cube_176" index="0"]
|
||||
collision_layer = 3
|
||||
|
||||
@@ -27,7 +27,7 @@ shader_parameter/floorRoughnessMap = ExtResource("4_rir86")
|
||||
shader_parameter/floorNormalMap = ExtResource("3_f1b6h")
|
||||
shader_parameter/floorHeightMap = ExtResource("2_0e3id")
|
||||
shader_parameter/floorUvScale = 0.5
|
||||
shader_parameter/enablePom = true
|
||||
shader_parameter/enablePom = false
|
||||
shader_parameter/heightMinLayers = 8
|
||||
shader_parameter/heightMaxLayers = 64
|
||||
shader_parameter/heightScale = 0.08
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
[gd_resource type="VisualShader" format=3 uid="uid://ce18qeqecjf4w"]
|
||||
|
||||
[resource]
|
||||
code = "shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_opaque, depth_test_default, cull_back, diffuse_lambert, specular_schlick_ggx;
|
||||
|
||||
|
||||
|
||||
"
|
||||
nodes/fragment/0/position = Vector2(280, 0)
|
||||
@@ -185,7 +185,7 @@ void fragment() {
|
||||
}
|
||||
|
||||
void light() {
|
||||
float lambert = dot(NORMAL, LIGHT);
|
||||
float halfLambert = pow(lambert*0.5 + 0.5, 2);
|
||||
DIFFUSE_LIGHT = halfLambert * ATTENUATION * LIGHT_COLOR / PI;
|
||||
float lambert = clamp(dot(NORMAL, LIGHT), 0.0, 1.0);
|
||||
float halfLambert = pow(lambert*0.5 + 0.5, 5);
|
||||
DIFFUSE_LIGHT += halfLambert * ATTENUATION * LIGHT_COLOR / PI;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ shader_parameter/floorRoughnessMap = ExtResource("4_4vhk1")
|
||||
shader_parameter/floorNormalMap = ExtResource("3_ytvoj")
|
||||
shader_parameter/floorHeightMap = ExtResource("2_4vhk1")
|
||||
shader_parameter/floorUvScale = 0.5
|
||||
shader_parameter/enablePom = true
|
||||
shader_parameter/enablePom = false
|
||||
shader_parameter/heightMinLayers = 8
|
||||
shader_parameter/heightMaxLayers = 64
|
||||
shader_parameter/heightScale = 0.2
|
||||
|
||||
@@ -27,7 +27,7 @@ shader_parameter/floorRoughnessMap = ExtResource("4_ob11h")
|
||||
shader_parameter/floorNormalMap = ExtResource("3_ff2cr")
|
||||
shader_parameter/floorHeightMap = ExtResource("2_roy1o")
|
||||
shader_parameter/floorUvScale = 0.5
|
||||
shader_parameter/enablePom = true
|
||||
shader_parameter/enablePom = false
|
||||
shader_parameter/heightMinLayers = 8
|
||||
shader_parameter/heightMaxLayers = 64
|
||||
shader_parameter/heightScale = 1.0
|
||||
|
||||
@@ -567,6 +567,12 @@ use_collision = true
|
||||
size = Vector3(3, 1, 0.25)
|
||||
material = ExtResource("3_vvhq3")
|
||||
|
||||
[node name="CSGBox3D57" type="CSGBox3D" parent="Greybox/Mantles"]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -13, 3.5, -21.629175)
|
||||
use_collision = true
|
||||
size = Vector3(5, 1, 0.25)
|
||||
material = ExtResource("3_vvhq3")
|
||||
|
||||
[node name="CSGBox3D54" type="CSGBox3D" parent="Greybox/Mantles"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.5, 1, 20.125)
|
||||
use_collision = true
|
||||
|
||||
@@ -102,6 +102,7 @@ player = NodePath("../Player")
|
||||
pause = ExtResource("10_0ari0")
|
||||
|
||||
[node name="TutorialController" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -374,9 +375,10 @@ shadow_opacity = 0.95
|
||||
shadow_blur = 2.435
|
||||
|
||||
[node name="Player" parent="." node_paths=PackedStringArray("TutorialWeaponTarget") instance=ExtResource("1_2vsi6")]
|
||||
transform = Transform3D(0.054514527, 0, -0.9985129, 0, 1, 0, 0.9985129, 0, 0.054514527, 0, -132.75, 118)
|
||||
transform = Transform3D(0.054514527, 0, -0.9985129, 0, 1, 0, 0.9985129, 0, 0.054514527, -6, 75.5, -13.5)
|
||||
collision_layer = 17
|
||||
TutorialWeaponTarget = NodePath("../PlacedTutorialWeapon/WeaponLocationTarget")
|
||||
TutorialDone = true
|
||||
AccelerationAir = 1.5
|
||||
|
||||
[node name="DebugLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
@@ -66,7 +66,6 @@ WalkSpeed = 7.5
|
||||
AccelerationAir = 0.8
|
||||
DecelerationAir = 0.02
|
||||
Weight = 4.0
|
||||
MantleTime = 0.3
|
||||
MantlePath = ExtResource("2_6lejt")
|
||||
CoyoteTime = 0.3
|
||||
InputBufferFrames = 5
|
||||
@@ -257,10 +256,10 @@ offset_left = 1524.0
|
||||
offset_top = 1.0
|
||||
offset_right = -8.0
|
||||
offset_bottom = 1.0
|
||||
enabled = false
|
||||
initial_node_to_watch = NodePath("../StateChart")
|
||||
|
||||
[node name="UI" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -506,6 +505,12 @@ to = NodePath("../../Grounded")
|
||||
event = &"grounded"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnMantleOtherSide" type="Node" parent="StateChart/Root/Movement/Mantling"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../OnWall/Hugging")
|
||||
event = &"on_wall"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Jump" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("SimpleJump")
|
||||
|
||||
@@ -801,6 +801,11 @@ public partial class PlayerController : CharacterBody3D
|
||||
private Transform3D _customMantleStartTransform;
|
||||
private Curve3D _customMantleCurve;
|
||||
private Vector3 _mantleStartPosition;
|
||||
|
||||
private Vector3 _velocityOnMantleStarted = Vector3.Zero;
|
||||
|
||||
private bool _mantleEndedOnOtherSideOfWall = false;
|
||||
private bool _mantleFoundGround = false;
|
||||
public void OnMantleStarted()
|
||||
{
|
||||
HeadSystem.OnMantle();
|
||||
@@ -812,16 +817,21 @@ public partial class PlayerController : CharacterBody3D
|
||||
return;
|
||||
}
|
||||
|
||||
_velocityOnMantleStarted = Velocity;
|
||||
|
||||
var transform = _customMantle ? _customMantleStartTransform : MantleSystem.GlobalTransform;
|
||||
var curve = _customMantle ? _customMantleCurve : MantleSystem.MantleCurve;
|
||||
_mantleEndedOnOtherSideOfWall = _customMantle ? _mantleEndedOnOtherSideOfWall : MantleSystem.EndedOnOtherSideOfWall;
|
||||
_mantleFoundGround = _customMantle ? _mantleFoundGround : MantleSystem.FoundGround;
|
||||
GetTree().GetRoot().AddChild(_mantlePath);
|
||||
_mantlePath.Setup(transform, curve);
|
||||
_mantleStartPosition = GlobalPosition;
|
||||
|
||||
var curveLength = curve.GetBakedLength();
|
||||
var tween = GetTree().CreateTween();
|
||||
tween.SetTrans(Tween.TransitionType.Linear);
|
||||
tween.SetEase(Tween.EaseType.InOut);
|
||||
tween.TweenProperty(_mantlePath.PathFollow, "progress_ratio", 1, MantleTime);
|
||||
tween.SetEase(Tween.EaseType.In);
|
||||
tween.TweenProperty(_mantlePath.PathFollow, "progress_ratio", 1, MantleTime*curveLength);
|
||||
tween.Finished += MantleFinished;
|
||||
}
|
||||
|
||||
@@ -843,13 +853,17 @@ public partial class PlayerController : CharacterBody3D
|
||||
public void MantleFinished()
|
||||
{
|
||||
_mantlePath.Teardown();
|
||||
|
||||
// SetVelocity(_finalCurveDirection.Normalized() * _speedOverCurve);
|
||||
|
||||
var isThereMovementInput = GetMoveInput().Length() > 0;
|
||||
if (isThereMovementInput)
|
||||
{
|
||||
// If there's a movement input on Mantle, we dash in the direction the mantle took place
|
||||
// If there's a movement input on Mantle, we dash in the direction the mantle ended with
|
||||
var positionDifference = GlobalPosition - _mantleStartPosition;
|
||||
var directionHorizontal = new Vector3(positionDifference.X, 0, positionDifference.Z);
|
||||
SimpleDashInDirection(directionHorizontal.Normalized());
|
||||
// SimpleDashInDirection(directionHorizontal.Normalized());
|
||||
SetVelocity(directionHorizontal.Normalized() * WalkSpeed);
|
||||
}
|
||||
|
||||
_customMantle = false;
|
||||
@@ -1124,6 +1138,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
_customMantle = DashSystem.ShouldMantle;
|
||||
_customMantleCurve = DashSystem.MantleSystem.MantleCurve;
|
||||
_customMantleStartTransform = DashSystem.MantleSystem.GlobalTransform;
|
||||
_mantleEndedOnOtherSideOfWall = DashSystem.MantleSystem.EndedOnOtherSideOfWall;
|
||||
_mantleFoundGround = DashSystem.MantleSystem.FoundGround;
|
||||
}
|
||||
|
||||
Tween CreatePositionTween(Vector3 targetLocation, float tweenTime)
|
||||
|
||||
@@ -161,5 +161,6 @@ common/physics_interpolation=true
|
||||
[rendering]
|
||||
|
||||
textures/vram_compression/import_etc2_astc=true
|
||||
lights_and_shadows/directional_shadow/soft_shadow_filter_quality=5
|
||||
environment/volumetric_fog/volume_size=256
|
||||
environment/volumetric_fog/volume_depth=256
|
||||
|
||||
@@ -21,6 +21,8 @@ public partial class MantleSystem: Node3D
|
||||
public Vector3 FirstMantleProfilePoint { get; private set; } = Vector3.Zero;
|
||||
|
||||
public bool IsMantlePossible { get; private set; } = false;
|
||||
public bool EndedOnOtherSideOfWall { get; private set; } = false;
|
||||
public bool FoundGround { get; private set; } = false;
|
||||
public const int WallProfileCastCount = 7;
|
||||
|
||||
private ShapeCast3D[] _wallProfileShapecasts = new ShapeCast3D[WallProfileCastCount];
|
||||
@@ -55,6 +57,8 @@ public partial class MantleSystem: Node3D
|
||||
|
||||
// Reset state
|
||||
IsMantlePossible = false;
|
||||
EndedOnOtherSideOfWall = false;
|
||||
FoundGround = false;
|
||||
if (!isColliding) return;
|
||||
|
||||
// Check if face something wall-like that should be climbable
|
||||
@@ -62,6 +66,7 @@ public partial class MantleSystem: Node3D
|
||||
if (collisionNormal.Y > 0.7f) return;
|
||||
|
||||
var spaceState = GetWorld3D().DirectSpaceState;
|
||||
|
||||
MantleCurve = new Curve3D();
|
||||
MantleCurve.AddPoint(Vector3.Zero);
|
||||
var hasFirstProfileHit = false;
|
||||
@@ -76,7 +81,19 @@ public partial class MantleSystem: Node3D
|
||||
// Got to the other side of the wall, we stop there
|
||||
if (!wallProfileShapecast.IsColliding())
|
||||
{
|
||||
// MantleCurve.AddPoint(ToLocal(globalTargetPosition));
|
||||
/*EndedOnOtherSideOfWall = true;
|
||||
|
||||
var origin = globalTargetPosition;
|
||||
var end = origin + Vector3.Down*0.51f; // We check for the ground a bit below our target
|
||||
var groundQuery = PhysicsRayQueryParameters3D.Create(origin, end, wallProfileShapecast.CollisionMask);
|
||||
var groundResult = spaceState.IntersectRay(groundQuery);
|
||||
if (groundResult.Count > 0)
|
||||
{
|
||||
// We found the ground, this is our final location
|
||||
FoundGround = true;
|
||||
Vector3 position = (Vector3) groundResult["position"];
|
||||
MantleCurve.AddPoint(ToLocal(position));
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user