mirror of
https://github.com/PashaBibko/The-Mobius-Line.git
synced 2026-04-04 01:49:07 +00:00
Changed how slope detection works
There is a bug with the camera
This commit is contained in:
@@ -623,9 +623,6 @@ MonoBehaviour:
|
|||||||
m_GroundMask:
|
m_GroundMask:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 3072
|
m_Bits: 3072
|
||||||
m_SlopeMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 2048
|
|
||||||
m_SlideRequiredSpeed: 1
|
m_SlideRequiredSpeed: 1
|
||||||
m_SlideScaler: 0.6
|
m_SlideScaler: 0.6
|
||||||
m_SlideDrag: 3
|
m_SlideDrag: 3
|
||||||
@@ -1775,7 +1772,7 @@ Canvas:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_RenderMode: 1
|
m_RenderMode: 1
|
||||||
m_Camera: {fileID: 963194227}
|
m_Camera: {fileID: 0}
|
||||||
m_PlaneDistance: 1
|
m_PlaneDistance: 1
|
||||||
m_PixelPerfect: 1
|
m_PixelPerfect: 1
|
||||||
m_ReceivesEvents: 1
|
m_ReceivesEvents: 1
|
||||||
@@ -4140,6 +4137,115 @@ MeshFilter:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 543919274}
|
m_GameObject: {fileID: 543919274}
|
||||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!1 &555852633
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 555852637}
|
||||||
|
- component: {fileID: 555852636}
|
||||||
|
- component: {fileID: 555852635}
|
||||||
|
- component: {fileID: 555852634}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Camera
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!81 &555852634
|
||||||
|
AudioListener:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 555852633}
|
||||||
|
m_Enabled: 1
|
||||||
|
--- !u!114 &555852635
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 555852633}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5cfd42fc2ed2f504dae2b9e7095401cf, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Sensitivity: {x: 1200, y: 800}
|
||||||
|
m_MaxAngle: 85
|
||||||
|
m_Orientation: {fileID: 166780449}
|
||||||
|
m_Tracking: {fileID: 963194228}
|
||||||
|
--- !u!20 &555852636
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 555852633}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 1
|
||||||
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
m_projectionMatrixMode: 1
|
||||||
|
m_GateFitMode: 2
|
||||||
|
m_FOVAxisMode: 0
|
||||||
|
m_Iso: 200
|
||||||
|
m_ShutterSpeed: 0.005
|
||||||
|
m_Aperture: 16
|
||||||
|
m_FocusDistance: 10
|
||||||
|
m_FocalLength: 50
|
||||||
|
m_BladeCount: 5
|
||||||
|
m_Curvature: {x: 2, y: 11}
|
||||||
|
m_BarrelClipping: 0.25
|
||||||
|
m_Anamorphism: 0
|
||||||
|
m_SensorSize: {x: 36, y: 24}
|
||||||
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_NormalizedViewPortRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
near clip plane: 0.3
|
||||||
|
far clip plane: 1000
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 0
|
||||||
|
orthographic size: 5
|
||||||
|
m_Depth: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 0}
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
m_TargetEye: 3
|
||||||
|
m_HDR: 1
|
||||||
|
m_AllowMSAA: 1
|
||||||
|
m_AllowDynamicResolution: 0
|
||||||
|
m_ForceIntoRT: 0
|
||||||
|
m_OcclusionCulling: 1
|
||||||
|
m_StereoConvergence: 10
|
||||||
|
m_StereoSeparation: 0.022
|
||||||
|
--- !u!4 &555852637
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 555852633}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 16.635672, y: 8.343683, z: -5.1720905}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &609667110
|
--- !u!1 &609667110
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -7082,75 +7188,13 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 963194228}
|
- component: {fileID: 963194228}
|
||||||
- component: {fileID: 963194229}
|
|
||||||
- component: {fileID: 963194227}
|
|
||||||
- component: {fileID: 963194226}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Main Camera
|
m_Name: CameraHolder
|
||||||
m_TagString: MainCamera
|
m_TagString: MainCamera
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!81 &963194226
|
|
||||||
AudioListener:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 963194225}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!20 &963194227
|
|
||||||
Camera:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 963194225}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ClearFlags: 1
|
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
|
||||||
m_projectionMatrixMode: 1
|
|
||||||
m_GateFitMode: 2
|
|
||||||
m_FOVAxisMode: 0
|
|
||||||
m_Iso: 200
|
|
||||||
m_ShutterSpeed: 0.005
|
|
||||||
m_Aperture: 16
|
|
||||||
m_FocusDistance: 10
|
|
||||||
m_FocalLength: 50
|
|
||||||
m_BladeCount: 5
|
|
||||||
m_Curvature: {x: 2, y: 11}
|
|
||||||
m_BarrelClipping: 0.25
|
|
||||||
m_Anamorphism: 0
|
|
||||||
m_SensorSize: {x: 36, y: 24}
|
|
||||||
m_LensShift: {x: 0, y: 0}
|
|
||||||
m_NormalizedViewPortRect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
width: 1
|
|
||||||
height: 1
|
|
||||||
near clip plane: 0.3
|
|
||||||
far clip plane: 1000
|
|
||||||
field of view: 60
|
|
||||||
orthographic: 0
|
|
||||||
orthographic size: 5
|
|
||||||
m_Depth: -1
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_RenderingPath: -1
|
|
||||||
m_TargetTexture: {fileID: 0}
|
|
||||||
m_TargetDisplay: 0
|
|
||||||
m_TargetEye: 3
|
|
||||||
m_HDR: 1
|
|
||||||
m_AllowMSAA: 1
|
|
||||||
m_AllowDynamicResolution: 0
|
|
||||||
m_ForceIntoRT: 0
|
|
||||||
m_OcclusionCulling: 1
|
|
||||||
m_StereoConvergence: 10
|
|
||||||
m_StereoSeparation: 0.022
|
|
||||||
--- !u!4 &963194228
|
--- !u!4 &963194228
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -7166,21 +7210,6 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1174770951}
|
m_Father: {fileID: 1174770951}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &963194229
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 963194225}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 5cfd42fc2ed2f504dae2b9e7095401cf, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_Sensitivity: {x: 1200, y: 800}
|
|
||||||
m_MaxAngle: 85
|
|
||||||
m_Orientation: {fileID: 166780449}
|
|
||||||
--- !u!1 &974940780
|
--- !u!1 &974940780
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -13511,3 +13540,4 @@ SceneRoots:
|
|||||||
- {fileID: 2043134296}
|
- {fileID: 2043134296}
|
||||||
- {fileID: 236811070}
|
- {fileID: 236811070}
|
||||||
- {fileID: 1971092436}
|
- {fileID: 1971092436}
|
||||||
|
- {fileID: 555852637}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class CameraController : MonoBehaviour
|
|||||||
|
|
||||||
[Header("References")]
|
[Header("References")]
|
||||||
[SerializeField] Transform m_Orientation;
|
[SerializeField] Transform m_Orientation;
|
||||||
|
[SerializeField] Transform m_Tracking;
|
||||||
|
|
||||||
// Private variables //
|
// Private variables //
|
||||||
|
|
||||||
@@ -65,5 +66,8 @@ public class CameraController : MonoBehaviour
|
|||||||
// Applies the rotation to the objects within Unity
|
// Applies the rotation to the objects within Unity
|
||||||
m_Orientation.rotation = Quaternion.Euler(0, m_Rotation.y, 0);
|
m_Orientation.rotation = Quaternion.Euler(0, m_Rotation.y, 0);
|
||||||
transform.rotation = Quaternion.Euler(m_Rotation.x, m_Rotation.y, 0);
|
transform.rotation = Quaternion.Euler(m_Rotation.x, m_Rotation.y, 0);
|
||||||
|
|
||||||
|
// Sets its location to where it is tracking
|
||||||
|
transform.position = m_Tracking.position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public partial class PlayerMovement : MonoBehaviour
|
|||||||
if (m_OnSlope)
|
if (m_OnSlope)
|
||||||
{
|
{
|
||||||
// Calculates better move direction for sliding
|
// Calculates better move direction for sliding
|
||||||
m_MoveDir = Vector3.ProjectOnPlane(m_MoveDir, m_SlopeHit.normal).normalized;
|
m_MoveDir = Vector3.ProjectOnPlane(m_MoveDir, m_StandingOn.normal).normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs correct update function depending on player state
|
// Runs correct update function depending on player state
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ public partial class PlayerMovement : MonoBehaviour
|
|||||||
[Header("Ground Check")]
|
[Header("Ground Check")]
|
||||||
[SerializeField] float m_PlayerHeight;
|
[SerializeField] float m_PlayerHeight;
|
||||||
[SerializeField] LayerMask m_GroundMask;
|
[SerializeField] LayerMask m_GroundMask;
|
||||||
[SerializeField] LayerMask m_SlopeMask;
|
|
||||||
|
|
||||||
[Header("Sliding Settings")]
|
[Header("Sliding Settings")]
|
||||||
[SerializeField] float m_SlideRequiredSpeed;
|
[SerializeField] float m_SlideRequiredSpeed;
|
||||||
@@ -71,9 +70,8 @@ public partial class PlayerMovement : MonoBehaviour
|
|||||||
bool m_FlippedWallRideDirectionFirstFrame = false;
|
bool m_FlippedWallRideDirectionFirstFrame = false;
|
||||||
Vector3 m_LastWallNormal;
|
Vector3 m_LastWallNormal;
|
||||||
|
|
||||||
// Raycast hit objects
|
// What the player is standing on
|
||||||
RaycastHit m_GroundHit;
|
RaycastHit m_StandingOn;
|
||||||
RaycastHit m_SlopeHit;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
BoxCollider m_WallCollider;
|
BoxCollider m_WallCollider;
|
||||||
|
|||||||
@@ -43,11 +43,13 @@ public partial class PlayerMovement : MonoBehaviour
|
|||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
// Performs raycasts to see what the player is standing on
|
// Performs raycasts to see what the player is standing on
|
||||||
m_Grounded = Physics.Raycast(transform.position, Vector3.down, out m_GroundHit, m_PlayerHeight * 0.5f + 0.3f, m_GroundMask);
|
m_Grounded = Physics.Raycast(transform.position, Vector3.down, out m_StandingOn, m_PlayerHeight * 0.5f + 0.3f, m_GroundMask);
|
||||||
m_OnSlope = Physics.Raycast(transform.position, Vector3.down, out m_SlopeHit, m_PlayerHeight * 0.5f + 0.3f, m_SlopeMask);
|
m_OnSlope = m_StandingOn.normal != new Vector3(0.0f, 1.0f, 0.0f) && m_Grounded;
|
||||||
|
|
||||||
|
Debug.Log(m_OnSlope + " | " + m_StandingOn.normal);
|
||||||
|
|
||||||
// Checks the player is far enough of the ground to start wall running
|
// Checks the player is far enough of the ground to start wall running
|
||||||
m_IsFarEnoughOffGroundToWallRide = m_GroundHit.distance > m_DistanceOfFloorToWallRide;
|
m_IsFarEnoughOffGroundToWallRide = m_StandingOn.distance > m_DistanceOfFloorToWallRide;
|
||||||
|
|
||||||
// Updates the state of the user input
|
// Updates the state of the user input
|
||||||
UpdateInput();
|
UpdateInput();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public partial class PlayerMovement : MonoBehaviour
|
|||||||
// Correctly applies force on slopes
|
// Correctly applies force on slopes
|
||||||
if (m_OnSlope)
|
if (m_OnSlope)
|
||||||
{
|
{
|
||||||
Vector3 slopeDir = m_SlopeHit.normal;
|
Vector3 slopeDir = m_StandingOn.normal;
|
||||||
slopeDir.y = 0.0f - slopeDir.y;
|
slopeDir.y = 0.0f - slopeDir.y;
|
||||||
m_Body.AddForce(slopeDir.normalized * m_SlideSpeed * m_Body.mass * 10, ForceMode.Force);
|
m_Body.AddForce(slopeDir.normalized * m_SlideSpeed * m_Body.mass * 10, ForceMode.Force);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ Material:
|
|||||||
m_Texture: {fileID: 2800000, guid: 9397418d1d7b12543bf27fb61b93bbea, type: 3}
|
m_Texture: {fileID: 2800000, guid: 9397418d1d7b12543bf27fb61b93bbea, type: 3}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
- _EmissionMap:
|
- _EmissionMap:
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
|
|||||||
Reference in New Issue
Block a user