플레이어 움직임 버그 픽스

This commit is contained in:
백민승_crow 2026-02-02 11:31:20 +09:00
parent cd59821b0e
commit 3eb613aadc
2 changed files with 104 additions and 11 deletions

View File

@ -1803,6 +1803,97 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: dd314a3f767a46446b652103ace62042, type: 3} m_SourcePrefab: {fileID: 100100000, guid: dd314a3f767a46446b652103ace62042, type: 3}
--- !u!1 &725434421
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 725434422}
- component: {fileID: 725434423}
m_Layer: 3
m_Name: Square
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &725434422
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 725434421}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -2, z: 0}
m_LocalScale: {x: 0.2, y: 4, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1336513113}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &725434423
SpriteRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 725434421}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!1 &786551887 --- !u!1 &786551887
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3713,7 +3804,7 @@ GameObject:
- component: {fileID: 1336513115} - component: {fileID: 1336513115}
- component: {fileID: 1336513114} - component: {fileID: 1336513114}
- component: {fileID: 1336513117} - component: {fileID: 1336513117}
m_Layer: 0 m_Layer: 3
m_Name: Square (1) m_Name: Square (1)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -3729,10 +3820,11 @@ Transform:
m_GameObject: {fileID: 1336513112} m_GameObject: {fileID: 1336513112}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.571, y: 0.87, z: 0} m_LocalPosition: {x: 1.571, y: 2.46, z: 0}
m_LocalScale: {x: 0.19690073, y: 4.3936, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children:
- {fileID: 725434422}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!233 &1336513114 --- !u!233 &1336513114
@ -3751,7 +3843,7 @@ HingeJoint2D:
m_BreakAction: 3 m_BreakAction: 3
m_AutoConfigureConnectedAnchor: 1 m_AutoConfigureConnectedAnchor: 1
m_Anchor: {x: 0, y: 0.5} m_Anchor: {x: 0, y: 0.5}
m_ConnectedAnchor: {x: 0.011000037, y: -0.11319995} m_ConnectedAnchor: {x: 0.011000037, y: -0.22000003}
m_UseConnectedAnchor: 1 m_UseConnectedAnchor: 1
m_UseMotor: 0 m_UseMotor: 0
m_Motor: m_Motor:
@ -3881,7 +3973,7 @@ BoxCollider2D:
m_UsedByEffector: 0 m_UsedByEffector: 0
m_CompositeOperation: 0 m_CompositeOperation: 0
m_CompositeOrder: 0 m_CompositeOrder: 0
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: -2}
m_SpriteTilingProperty: m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
@ -3891,7 +3983,7 @@ BoxCollider2D:
drawMode: 0 drawMode: 0
adaptiveTiling: 0 adaptiveTiling: 0
m_AutoTiling: 0 m_AutoTiling: 0
m_Size: {x: 1, y: 1} m_Size: {x: 0.2, y: 4}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!1 &1478180728 --- !u!1 &1478180728
GameObject: GameObject:

View File

@ -70,14 +70,14 @@ public class PlayerMovement : MonoBehaviour
{ {
isHanging = false; isHanging = false;
_rigidbody2D.bodyType = RigidbodyType2D.Dynamic; _rigidbody2D.bodyType = RigidbodyType2D.Dynamic;
transform.parent = null; transform.SetParent(null, true);
} }
private void HangingObject() private void HangingObject()
{ {
isHanging = true; isHanging = true;
_rigidbody2D.bodyType = RigidbodyType2D.Kinematic;
_rigidbody2D.linearVelocity = Vector2.zero; _rigidbody2D.linearVelocity = Vector2.zero;
_rigidbody2D.bodyType = RigidbodyType2D.Kinematic;
SnapToWall(); SnapToWall();
} }
@ -101,7 +101,7 @@ public class PlayerMovement : MonoBehaviour
private void SnapToWall() private void SnapToWall()
{ {
float direction = transform.rotation.eulerAngles.y == 180 ? -1f : 1f; float direction = transform.rotation.eulerAngles.y == 180 ? -1f : 1f;
RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.right * direction, 1.0f, groundLayer); RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.right * direction, 1f, groundLayer);
if (hit.collider != null) if (hit.collider != null)
{ {
@ -109,7 +109,8 @@ public class PlayerMovement : MonoBehaviour
float newX = hit.point.x - (direction * playerHalfWidth); float newX = hit.point.x - (direction * playerHalfWidth);
transform.position = new Vector2(newX, transform.position.y); transform.position = new Vector2(newX, transform.position.y);
gameObject.transform.SetParent(hit.collider.transform);
gameObject.transform.SetParent(hit.transform, true);
} }
} }
} }