From 3565b47fd64778fc7be630aea89fcd99d1907a07 Mon Sep 17 00:00:00 2001 From: Neil Kollack Date: Sun, 10 Apr 2022 17:53:36 -0500 Subject: wip: LineRenderer updated via pseudophysics --- Assets/Animations/MontanaJohns.meta | 8 + .../MontanaJohns/MontanaJohns.controller | 72 +++ .../MontanaJohns/MontanaJohns.controller.meta | 8 + Assets/Animations/MontanaJohns/Player.controller | 72 +++ .../Animations/MontanaJohns/Player.controller.meta | 8 + Assets/Animations/MontanaJohns/run.anim | 89 ++++ Assets/Animations/MontanaJohns/run.anim.meta | 8 + Assets/Animations/Prototype/Run.anim | 4 +- Assets/Prefabs/Hook.prefab | 12 +- Assets/Prefabs/Player.prefab | 4 +- Assets/Scenes/Jungle.unity | 44 +- Assets/Scripts/RopePrototype.cs | 106 +++- Assets/Sprites/Player/MontanaJohns.meta | 8 + .../MontanaJohns/MontanaJohnsLandingPreRun.png | Bin 0 -> 8337 bytes .../MontanaJohnsLandingPreRun.png.meta | 540 +++++++++++++++++++++ ProjectSettings/QualitySettings.asset | 1 + 16 files changed, 967 insertions(+), 17 deletions(-) create mode 100644 Assets/Animations/MontanaJohns.meta create mode 100644 Assets/Animations/MontanaJohns/MontanaJohns.controller create mode 100644 Assets/Animations/MontanaJohns/MontanaJohns.controller.meta create mode 100644 Assets/Animations/MontanaJohns/Player.controller create mode 100644 Assets/Animations/MontanaJohns/Player.controller.meta create mode 100644 Assets/Animations/MontanaJohns/run.anim create mode 100644 Assets/Animations/MontanaJohns/run.anim.meta create mode 100644 Assets/Sprites/Player/MontanaJohns.meta create mode 100644 Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png create mode 100644 Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png.meta diff --git a/Assets/Animations/MontanaJohns.meta b/Assets/Animations/MontanaJohns.meta new file mode 100644 index 0000000..6005515 --- /dev/null +++ b/Assets/Animations/MontanaJohns.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 266df54c1e6640943b5549c0a60fbc37 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/MontanaJohns/MontanaJohns.controller b/Assets/Animations/MontanaJohns/MontanaJohns.controller new file mode 100644 index 0000000..cfb8eec --- /dev/null +++ b/Assets/Animations/MontanaJohns/MontanaJohns.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-4381722352777846568 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Run + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 16f0d19faa73a274788329f7368084f1, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MontanaJohns + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 830988249226544064} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &830988249226544064 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -4381722352777846568} + m_Position: {x: 380, y: 120, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -4381722352777846568} diff --git a/Assets/Animations/MontanaJohns/MontanaJohns.controller.meta b/Assets/Animations/MontanaJohns/MontanaJohns.controller.meta new file mode 100644 index 0000000..d38ee98 --- /dev/null +++ b/Assets/Animations/MontanaJohns/MontanaJohns.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5b3446f9fca03924ea2739d6e2d1f00e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/MontanaJohns/Player.controller b/Assets/Animations/MontanaJohns/Player.controller new file mode 100644 index 0000000..4d4a73d --- /dev/null +++ b/Assets/Animations/MontanaJohns/Player.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-989215695225172247 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -45171433127652272} + m_Position: {x: 330, y: 110, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -45171433127652272} +--- !u!1102 &-45171433127652272 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: run + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 16f0d19faa73a274788329f7368084f1, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Player + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -989215695225172247} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Animations/MontanaJohns/Player.controller.meta b/Assets/Animations/MontanaJohns/Player.controller.meta new file mode 100644 index 0000000..ff283bc --- /dev/null +++ b/Assets/Animations/MontanaJohns/Player.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ece3251730e7134f9bbe0852b7c6612 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/MontanaJohns/run.anim b/Assets/Animations/MontanaJohns/run.anim new file mode 100644 index 0000000..fdce640 --- /dev/null +++ b/Assets/Animations/MontanaJohns/run.anim @@ -0,0 +1,89 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: run + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: 1256470140, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - time: 0.083333336 + value: {fileID: -1042349849, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - time: 0.16666667 + value: {fileID: 216792634, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - time: 0.25 + value: {fileID: 1044303231, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - time: 0.33333334 + value: {fileID: 299380834, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - time: 0.41666666 + value: {fileID: -1460522098, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - time: 0.5 + value: {fileID: -1969183652, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - time: 0.5833333 + value: {fileID: -919123645, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + pptrCurveMapping: + - {fileID: 1256470140, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - {fileID: -1042349849, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - {fileID: 216792634, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - {fileID: 1044303231, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - {fileID: 299380834, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - {fileID: -1460522098, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - {fileID: -1969183652, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + - {fileID: -919123645, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.59999996 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Animations/MontanaJohns/run.anim.meta b/Assets/Animations/MontanaJohns/run.anim.meta new file mode 100644 index 0000000..ec1c104 --- /dev/null +++ b/Assets/Animations/MontanaJohns/run.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 16f0d19faa73a274788329f7368084f1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/Prototype/Run.anim b/Assets/Animations/Prototype/Run.anim index 7183182..bb7d17d 100644 --- a/Assets/Animations/Prototype/Run.anim +++ b/Assets/Animations/Prototype/Run.anim @@ -20,7 +20,7 @@ AnimationClip: m_PPtrCurves: - curve: - time: 0 - value: {fileID: -560681948, guid: 72a632f763991754fb9722d38264d272, type: 3} + value: {fileID: 927410543, guid: 72a632f763991754fb9722d38264d272, type: 3} - time: 0.083333336 value: {fileID: 927410543, guid: 72a632f763991754fb9722d38264d272, type: 3} - time: 0.16666667 @@ -54,7 +54,7 @@ AnimationClip: customType: 23 isPPtrCurve: 1 pptrCurveMapping: - - {fileID: -560681948, guid: 72a632f763991754fb9722d38264d272, type: 3} + - {fileID: 927410543, guid: 72a632f763991754fb9722d38264d272, type: 3} - {fileID: 927410543, guid: 72a632f763991754fb9722d38264d272, type: 3} - {fileID: -1632938849, guid: 72a632f763991754fb9722d38264d272, type: 3} - {fileID: -774491187, guid: 72a632f763991754fb9722d38264d272, type: 3} diff --git a/Assets/Prefabs/Hook.prefab b/Assets/Prefabs/Hook.prefab index 07111ea..434a3ee 100644 --- a/Assets/Prefabs/Hook.prefab +++ b/Assets/Prefabs/Hook.prefab @@ -105,7 +105,7 @@ Rigidbody2D: m_AngularDrag: 0.05 m_GravityScale: 1 m_Material: {fileID: 0} - m_Interpolate: 0 + m_Interpolate: 1 m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 0 @@ -125,7 +125,7 @@ DistanceJoint2D: m_AutoConfigureConnectedAnchor: 0 m_Anchor: {x: 0, y: 0} m_ConnectedAnchor: {x: 0, y: 0} - m_AutoConfigureDistance: 1 + m_AutoConfigureDistance: 0 m_Distance: 6 m_MaxDistanceOnly: 0 --- !u!114 &-2244153933399610223 @@ -140,9 +140,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f828efbe27e65524c9d7e0d87b6a6f0f, type: 3} m_Name: m_EditorClassIdentifier: - player: {fileID: 0} - lr: {fileID: 0} - dj: {fileID: 0} + constraintIterations: 50 + gravityMultiplier: 1 + lineWidth: 0.2 + ropeSegmentLength: 0.25 + segmentCount: 35 --- !u!120 &-1471091967506001749 LineRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 7d1fc4c..a93411e 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -79,7 +79,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 2055064200, guid: 72a632f763991754fb9722d38264d272, type: 3} + m_Sprite: {fileID: 1409862686, guid: 8b08bada3c2ac5e4cb65721a772f0f99, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 @@ -165,7 +165,7 @@ Rigidbody2D: m_AngularDrag: 0.05 m_GravityScale: 1 m_Material: {fileID: 0} - m_Interpolate: 0 + m_Interpolate: 1 m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 0 diff --git a/Assets/Scenes/Jungle.unity b/Assets/Scenes/Jungle.unity index 00a8dac..bfc0e65 100644 --- a/Assets/Scenes/Jungle.unity +++ b/Assets/Scenes/Jungle.unity @@ -1262,6 +1262,22 @@ PrefabInstance: propertyPath: mainCamera value: objectReference: {fileID: 519420031} + - target: {fileID: 5555712667017248079, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} + propertyPath: m_Size.x + value: 1.2 + objectReference: {fileID: 0} + - target: {fileID: 5555712667017248079, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} + propertyPath: m_Size.y + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 5555712667017248079, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} + propertyPath: m_Offset.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5555712667017248079, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} + propertyPath: m_Offset.y + value: -1 + objectReference: {fileID: 0} - target: {fileID: 5555712667017248113, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} propertyPath: m_Name value: Player @@ -1310,7 +1326,8 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 5555712667017248077, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} m_SourcePrefab: {fileID: 100100000, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} --- !u!1 &1411065714 GameObject: @@ -14191,6 +14208,31 @@ Tilemap: e31: 0 e32: 0 e33: 1 +--- !u!1 &2005986189 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5555712667017248113, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} + m_PrefabInstance: {fileID: 1016973329} + m_PrefabAsset: {fileID: 0} +--- !u!95 &2005986198 +Animator: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2005986189} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 5b3446f9fca03924ea2739d6e2d1f00e, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 --- !u!1 &2132358794 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/RopePrototype.cs b/Assets/Scripts/RopePrototype.cs index 84d6a18..d1aca32 100644 --- a/Assets/Scripts/RopePrototype.cs +++ b/Assets/Scripts/RopePrototype.cs @@ -4,10 +4,17 @@ using UnityEngine; public class RopePrototype : MonoBehaviour { - public GameObject player; - public LineRenderer lr; - public DistanceJoint2D dj; + public int constraintIterations = 50; + public float gravityMultiplier = 1.0f; + public float lineWidth = 0.1f; + public float ropeSegmentLength = 0.25f; + public int segmentCount = 35; + LineRenderer lr; + DistanceJoint2D dj; + GameObject player; + List ropeSegments = new List(); + Vector3[] ropePositions; bool ropeCreated = false; // Start is called before the first frame update @@ -16,8 +23,17 @@ public class RopePrototype : MonoBehaviour player = GameObject.FindGameObjectWithTag("Player"); dj = GetComponent(); lr = GetComponent(); - lr.positionCount = 2; - lr.SetPosition(0, transform.position); + lr.startWidth = lineWidth; + lr.endWidth = lineWidth; + ropePositions = new Vector3[segmentCount]; + lr.positionCount = segmentCount; + Vector2 ropeLoc = transform.position; + + for (int i = 0; i < segmentCount; i++) + { + ropeSegments.Add(new RopeSegment(ropeLoc)); + ropeLoc.y -= ropeSegmentLength; + } } // Update is called once per frame @@ -28,18 +44,94 @@ public class RopePrototype : MonoBehaviour CreateRope(); ropeCreated = true; } - RenderLine(); } + void FixedUpdate() + { + Simulate(); + } + void RenderLine() { - lr.SetPosition(1, player.transform.position); + for(int i = 0; i < ropePositions.Length; i++) + { + ropePositions[i] = ropeSegments[i].posNow; + } + lr.SetPositions(ropePositions); } void CreateRope() { dj.connectedBody = player.GetComponent(); dj.maxDistanceOnly = true; + dj.distance = Vector2.Distance(player.transform.position, transform.position); + } + + void Simulate() + { + Vector2 gravityForce = new Vector2(0f, -gravityMultiplier); + + for(int i = 0; i < ropeSegments.Count; i++) + { + RopeSegment segment = ropeSegments[i]; + Vector2 velocity = segment.posNow - segment.posOld; + segment.posOld = segment.posNow; + segment.posNow += velocity; + segment.posNow += gravityForce * Time.deltaTime; + ropeSegments[i] = segment; + } + + for(int i = 0; i < constraintIterations; i++) + { + ApplyContraint(); + } + } + + void ApplyContraint() + { + RopeSegment endSegment1 = ropeSegments[0]; + endSegment1.posNow = transform.position; + ropeSegments[0] = endSegment1; + + RopeSegment endSegment2 = ropeSegments[ropeSegments.Count - 1]; + endSegment2.posNow = player.transform.position; + ropeSegments[ropeSegments.Count - 1] = endSegment2; + + for (int i = 0; i < ropeSegments.Count-1; i++) + { + RopeSegment segment1 = ropeSegments[i]; + RopeSegment segment2 = ropeSegments[i + 1]; + + float distance = (segment1.posNow - segment2.posNow).magnitude; + float error = distance - ropeSegmentLength; + Vector2 normalChange = (segment1.posNow - segment2.posNow).normalized; + Vector2 change = normalChange * error; + + if(i != 0) + { + segment1.posNow -= change * 0.5f; + ropeSegments[i] = segment1; + segment2.posNow += change * 0.5f; + ropeSegments[i + 1] = segment2; + } + else + { + segment2.posNow += change; + ropeSegments[i + 1] = segment2; + } + } + } + + public struct RopeSegment + { + public Vector2 posNow; + public Vector2 posOld; + + public RopeSegment(Vector2 pos) + { + this.posNow = pos; + this.posOld = pos; + } } } diff --git a/Assets/Sprites/Player/MontanaJohns.meta b/Assets/Sprites/Player/MontanaJohns.meta new file mode 100644 index 0000000..ad73076 --- /dev/null +++ b/Assets/Sprites/Player/MontanaJohns.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e372a4df912a04459307549abb0b986 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png b/Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png new file mode 100644 index 0000000..053e559 Binary files /dev/null and b/Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png differ diff --git a/Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png.meta b/Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png.meta new file mode 100644 index 0000000..612054a --- /dev/null +++ b/Assets/Sprites/Player/MontanaJohns/MontanaJohnsLandingPreRun.png.meta @@ -0,0 +1,540 @@ +fileFormatVersion: 2 +guid: 8b08bada3c2ac5e4cb65721a772f0f99 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 16 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_0 + rect: + serializedVersion: 2 + x: 0 + y: 161 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 7bd20026429302b4f937a2692191c495 + internalID: 1409862686 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_1 + rect: + serializedVersion: 2 + x: 600 + y: 161 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: effcf0774b53f794caaba2f4a25fefde + internalID: -161029916 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_2 + rect: + serializedVersion: 2 + x: 700 + y: 161 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: cea18626120fc1f4292393ab1b9db7bc + internalID: 1526622238 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_3 + rect: + serializedVersion: 2 + x: 0 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 01583759aca17564d9fc8d4ff7739e5d + internalID: 1256470140 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_4 + rect: + serializedVersion: 2 + x: 100 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 0cd0bfa24ca666a4fbd0b6bf86e08006 + internalID: -1042349849 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_5 + rect: + serializedVersion: 2 + x: 200 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 41cb4bb666edbed458752a2d9c9efca5 + internalID: 216792634 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_6 + rect: + serializedVersion: 2 + x: 300 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: e699e612a35ab064497869f077043622 + internalID: 1044303231 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_7 + rect: + serializedVersion: 2 + x: 400 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 8a46b9feb095f004487e87775afda903 + internalID: 299380834 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_8 + rect: + serializedVersion: 2 + x: 500 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 4f3f1c6c143762440a0c10e53c172020 + internalID: -1460522098 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_9 + rect: + serializedVersion: 2 + x: 600 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: f30d885d1fdb7474db05bb3b764f1ba8 + internalID: -1969183652 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_10 + rect: + serializedVersion: 2 + x: 700 + y: 81 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 1d51541ab5f6f8940b0f3e8056ffe79d + internalID: -919123645 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_11 + rect: + serializedVersion: 2 + x: 0 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 43f865f05c5f5384a9daaeb32a715139 + internalID: 508543913 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_12 + rect: + serializedVersion: 2 + x: 100 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: ecaf43ea5c36c6044948c16c538bd36e + internalID: -1075184750 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_13 + rect: + serializedVersion: 2 + x: 200 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 6d2c31700201c1440a2cf85c982a7f4d + internalID: -1586354681 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_14 + rect: + serializedVersion: 2 + x: 300 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 31016fa388aa3e749aa728060781af95 + internalID: 195716706 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_15 + rect: + serializedVersion: 2 + x: 400 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 40fcb2fd58e40114795f3f152086fa19 + internalID: -1728902432 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_16 + rect: + serializedVersion: 2 + x: 500 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: b1f2520e2a7ca7e419983e0c1794028c + internalID: 470777305 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_17 + rect: + serializedVersion: 2 + x: 600 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: de95cc37b62efea4791b4ccdaf19ebfd + internalID: 37177715 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: MontanaJohnsLandingPreRun_18 + rect: + serializedVersion: 2 + x: 700 + y: 1 + width: 100 + height: 79 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 5385afbc0fa433b40a09e33920d01f38 + internalID: -1727536245 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + MontanaJohnsLandingPreRun_8: -1460522098 + MontanaJohnsLandingPreRun_14: 195716706 + MontanaJohnsLandingPreRun_3: 1256470140 + MontanaJohnsLandingPreRun_5: 216792634 + MontanaJohnsLandingPreRun_16: 470777305 + MontanaJohnsLandingPreRun_11: 508543913 + MontanaJohnsLandingPreRun_0: 1409862686 + MontanaJohnsLandingPreRun_1: -161029916 + MontanaJohnsLandingPreRun_10: -919123645 + MontanaJohnsLandingPreRun_15: -1728902432 + MontanaJohnsLandingPreRun_7: 299380834 + MontanaJohnsLandingPreRun_4: -1042349849 + MontanaJohnsLandingPreRun_12: -1075184750 + MontanaJohnsLandingPreRun_2: 1526622238 + MontanaJohnsLandingPreRun_13: -1586354681 + MontanaJohnsLandingPreRun_18: -1727536245 + MontanaJohnsLandingPreRun_6: 1044303231 + MontanaJohnsLandingPreRun_9: -1969183652 + MontanaJohnsLandingPreRun_17: 37177715 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset index d24eb10..7bbcf0f 100644 --- a/ProjectSettings/QualitySettings.asset +++ b/ProjectSettings/QualitySettings.asset @@ -227,6 +227,7 @@ QualitySettings: Lumin: 5 Nintendo Switch: 5 PS4: 5 + Server: 0 Stadia: 5 Standalone: 5 WebGL: 3 -- cgit v1.2.3-70-g09d2