Skip to content

Commit

Permalink
Fix and refactor crouch+jump transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed Mar 25, 2024
1 parent 536f852 commit 2e3556a
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 94 deletions.
Binary file added Assets/Models/Props/Anvil.fbx
Binary file not shown.
108 changes: 108 additions & 0 deletions Assets/Models/Props/Anvil.fbx.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Assets/Prefabs/Input/Player.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fe68c66043cf4fa30b1b60bfdcd38608, type: 3}
m_Name:
m_EditorClassIdentifier:
ignoreMask:
groundCheckMask:
serializedVersion: 2
m_Bits: 65399
m_Bits: 83
lookSpeed: 3
LookSpeedZoom: 0.75
mouseZoomSpeedFactor: 0.1
Expand All @@ -83,9 +83,10 @@ MonoBehaviour:
minDashVelocity: 8
crouchedHeightOffset: 0.8
crouchedHeightGunOffset: 0.5
airThreshold: 0.4
airThreshold: 0.17
slopeAngleThreshold: 50
state: 1
jumpState: 0
animator: {fileID: 289053663840324231}
ZoomFov: 30
bottomCaster: {fileID: 4643888824660388301}
Expand Down Expand Up @@ -278,7 +279,7 @@ MonoBehaviour:
cameraParent: {fileID: 8159248892074053650}
ragdollMask:
serializedVersion: 2
m_Bits: 2147483647
m_Bits: 4294967295
--- !u!82 &7607358150439154286
AudioSource:
m_ObjectHideFlags: 0
Expand Down
10 changes: 3 additions & 7 deletions Assets/Scripts/Control&Input/AIMovement.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using UnityEngine;
using UnityEngine.AI;

Expand All @@ -28,7 +24,7 @@ private void Update()
if (timeSinceJump >= 3f)
{
timeSinceJump = timeSinceJump % 3f;
if (Physics.Raycast(transform.position, Target.position, ignoreMask) && !StateIsAir)
if (Physics.Raycast(transform.position, Target.position, groundCheckMask) && !StateIsAir)
this.enabled = false;
Jump();
}
Expand All @@ -38,7 +34,7 @@ protected override void FixedUpdate()
{
if (!StateIsAir && (!Target || Vector3.Distance(Target.position, transform.position) > 35))
{
this.enabled = false;
enabled = false;
return;
}
var direction = (Target.position - transform.position).normalized;
Expand All @@ -63,7 +59,7 @@ private void OnDisable()
agent.enabled = true;
}

public void Jump()
private void Jump()
{
if (StateIsAir)
return;
Expand Down
Loading

0 comments on commit 2e3556a

Please sign in to comment.