Improve player movement and add collision
This commit is contained in:
@@ -12,6 +12,7 @@ GameObject:
|
|||||||
- component: {fileID: 7692843314178062085}
|
- component: {fileID: 7692843314178062085}
|
||||||
- component: {fileID: 6118034672792182209}
|
- component: {fileID: 6118034672792182209}
|
||||||
- component: {fileID: 4194995354293255184}
|
- component: {fileID: 4194995354293255184}
|
||||||
|
- component: {fileID: -4152331571693237436}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Player
|
m_Name: Player
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -149,6 +150,33 @@ BoxCollider2D:
|
|||||||
m_AutoTiling: 0
|
m_AutoTiling: 0
|
||||||
m_Size: {x: 12.63, y: 12.63}
|
m_Size: {x: 12.63, y: 12.63}
|
||||||
m_EdgeRadius: 0
|
m_EdgeRadius: 0
|
||||||
|
--- !u!50 &-4152331571693237436
|
||||||
|
Rigidbody2D:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3739677681433878215}
|
||||||
|
m_BodyType: 0
|
||||||
|
m_Simulated: 1
|
||||||
|
m_UseFullKinematicContacts: 0
|
||||||
|
m_UseAutoMass: 0
|
||||||
|
m_Mass: 1
|
||||||
|
m_LinearDamping: 0
|
||||||
|
m_AngularDamping: 0.05
|
||||||
|
m_GravityScale: 1
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_SleepingMode: 1
|
||||||
|
m_CollisionDetection: 0
|
||||||
|
m_Constraints: 0
|
||||||
--- !u!1 &8669953498445216587
|
--- !u!1 &8669953498445216587
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -6,16 +6,15 @@ public class Teo : MonoBehaviour
|
|||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
transform.Translate(
|
Rigidbody2D controller = GetComponent<Rigidbody2D>();
|
||||||
Input.GetAxis("Horizontal")*moveSpeed*Time.deltaTime,
|
controller.linearVelocity = new Vector2 (
|
||||||
Input.GetAxis("Vertical")*moveSpeed*Time.deltaTime,
|
Input.GetAxis("Horizontal"),
|
||||||
0
|
Input.GetAxis("Vertical")
|
||||||
);
|
).normalized * moveSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
--- !u!55 &1
|
--- !u!55 &1
|
||||||
PhysicsManager:
|
PhysicsManager:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 13
|
serializedVersion: 17
|
||||||
m_Gravity: {x: 0, y: -9.81, z: 0}
|
m_Gravity: {x: 0, y: 0, z: 0}
|
||||||
m_DefaultMaterial: {fileID: 0}
|
m_DefaultMaterial: {fileID: 0}
|
||||||
m_BounceThreshold: 2
|
m_BounceThreshold: 2
|
||||||
|
m_DefaultMaxDepenetrationVelocity: 10
|
||||||
m_SleepThreshold: 0.005
|
m_SleepThreshold: 0.005
|
||||||
m_DefaultContactOffset: 0.01
|
m_DefaultContactOffset: 0.01
|
||||||
m_DefaultSolverIterations: 6
|
m_DefaultSolverIterations: 6
|
||||||
@@ -16,21 +17,21 @@ PhysicsManager:
|
|||||||
m_EnableAdaptiveForce: 0
|
m_EnableAdaptiveForce: 0
|
||||||
m_ClothInterCollisionDistance: 0.1
|
m_ClothInterCollisionDistance: 0.1
|
||||||
m_ClothInterCollisionStiffness: 0.2
|
m_ClothInterCollisionStiffness: 0.2
|
||||||
m_ContactsGeneration: 1
|
|
||||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||||
m_AutoSimulation: 1
|
m_SimulationMode: 0
|
||||||
m_AutoSyncTransforms: 0
|
m_AutoSyncTransforms: 0
|
||||||
m_ReuseCollisionCallbacks: 1
|
m_ReuseCollisionCallbacks: 1
|
||||||
|
m_InvokeCollisionCallbacks: 1
|
||||||
m_ClothInterCollisionSettingsToggle: 0
|
m_ClothInterCollisionSettingsToggle: 0
|
||||||
m_ClothGravity: {x: 0, y: -9.81, z: 0}
|
m_ClothGravity: {x: 0, y: -9.81, z: 0}
|
||||||
m_ContactPairsMode: 0
|
m_ContactPairsMode: 0
|
||||||
m_BroadphaseType: 0
|
m_BroadphaseType: 0
|
||||||
m_WorldBounds:
|
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
|
||||||
m_Extent: {x: 250, y: 250, z: 250}
|
|
||||||
m_WorldSubdivisions: 8
|
|
||||||
m_FrictionType: 0
|
m_FrictionType: 0
|
||||||
m_EnableEnhancedDeterminism: 0
|
m_EnableEnhancedDeterminism: 0
|
||||||
m_EnableUnifiedHeightmaps: 1
|
m_EnableUnifiedHeightmaps: 1
|
||||||
|
m_ImprovedPatchFriction: 0
|
||||||
m_SolverType: 0
|
m_SolverType: 0
|
||||||
m_DefaultMaxAngularSpeed: 50
|
m_DefaultMaxAngularSpeed: 50
|
||||||
|
m_ScratchBufferChunkCount: 4
|
||||||
|
m_CurrentBackendId: 4072204805
|
||||||
|
m_FastMotionThreshold: 3.4028235e+38
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
--- !u!19 &1
|
--- !u!19 &1
|
||||||
Physics2DSettings:
|
Physics2DSettings:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 5
|
serializedVersion: 6
|
||||||
m_Gravity: {x: 0, y: -9.81}
|
m_Gravity: {x: 0, y: 0}
|
||||||
m_DefaultMaterial: {fileID: 0}
|
m_DefaultMaterial: {fileID: 0}
|
||||||
m_VelocityIterations: 8
|
m_VelocityIterations: 8
|
||||||
m_PositionIterations: 3
|
m_PositionIterations: 3
|
||||||
m_VelocityThreshold: 1
|
m_BounceThreshold: 1
|
||||||
m_MaxLinearCorrection: 0.2
|
m_MaxLinearCorrection: 0.2
|
||||||
m_MaxAngularCorrection: 8
|
m_MaxAngularCorrection: 8
|
||||||
m_MaxTranslationSpeed: 100
|
m_MaxTranslationSpeed: 100
|
||||||
@@ -19,6 +19,7 @@ Physics2DSettings:
|
|||||||
m_LinearSleepTolerance: 0.01
|
m_LinearSleepTolerance: 0.01
|
||||||
m_AngularSleepTolerance: 2
|
m_AngularSleepTolerance: 2
|
||||||
m_DefaultContactOffset: 0.01
|
m_DefaultContactOffset: 0.01
|
||||||
|
m_ContactThreshold: 0
|
||||||
m_JobOptions:
|
m_JobOptions:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
useMultithreading: 0
|
useMultithreading: 0
|
||||||
@@ -39,18 +40,17 @@ Physics2DSettings:
|
|||||||
m_IslandSolverBodiesPerJob: 50
|
m_IslandSolverBodiesPerJob: 50
|
||||||
m_IslandSolverContactsPerJob: 50
|
m_IslandSolverContactsPerJob: 50
|
||||||
m_SimulationMode: 0
|
m_SimulationMode: 0
|
||||||
|
m_SimulationLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_MaxSubStepCount: 4
|
||||||
|
m_MinSubStepFPS: 30
|
||||||
|
m_UseSubStepping: 0
|
||||||
|
m_UseSubStepContacts: 0
|
||||||
m_QueriesHitTriggers: 1
|
m_QueriesHitTriggers: 1
|
||||||
m_QueriesStartInColliders: 1
|
m_QueriesStartInColliders: 1
|
||||||
m_CallbacksOnDisable: 1
|
m_CallbacksOnDisable: 1
|
||||||
m_ReuseCollisionCallbacks: 1
|
m_ReuseCollisionCallbacks: 1
|
||||||
m_AutoSyncTransforms: 0
|
m_AutoSyncTransforms: 0
|
||||||
m_AlwaysShowColliders: 0
|
m_GizmoOptions: 10
|
||||||
m_ShowColliderSleep: 1
|
|
||||||
m_ShowColliderContacts: 0
|
|
||||||
m_ShowColliderAABB: 0
|
|
||||||
m_ContactArrowScale: 0.2
|
|
||||||
m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
|
|
||||||
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
|
|
||||||
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
|
|
||||||
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
|
|
||||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||||
|
|||||||
Reference in New Issue
Block a user