diff --git a/spine-csharp/src/PathConstraint.cs b/spine-csharp/src/PathConstraint.cs index c0bc699ab..51f202c94 100644 --- a/spine-csharp/src/PathConstraint.cs +++ b/spine-csharp/src/PathConstraint.cs @@ -191,7 +191,7 @@ namespace Spine { pathLength = lengths[curveCount]; if (percentPosition) position *= pathLength; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spacesItems[i] *= pathLength; } world = this.world.Resize(8).Items; @@ -303,7 +303,7 @@ namespace Spine { position *= pathLength / path.lengths[curveCount - 1]; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spacesItems[i] *= pathLength; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java index e759d75e3..4901f4522 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java @@ -208,7 +208,7 @@ public class PathConstraint implements Constraint { float pathLength = lengths[curveCount]; if (percentPosition) position *= pathLength; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spaces[i] *= pathLength; } world = this.world.setSize(8); @@ -319,7 +319,7 @@ public class PathConstraint implements Constraint { else position *= pathLength / path.getLengths()[curveCount - 1]; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spaces[i] *= pathLength; } diff --git a/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity new file mode 100644 index 000000000..ba1cadb69 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity @@ -0,0 +1,716 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 8 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 3 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 + m_LightingDataAsset: {fileID: 0} + m_ShadowMaskMode: 2 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &466319114 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 466319119} + - component: {fileID: 466319118} + - component: {fileID: 466319117} + - component: {fileID: 466319116} + - component: {fileID: 466319115} + m_Layer: 0 + m_Name: spineboy limited - 2/60 offset + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &466319115 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1670ee04b19c794db301d734c71bdd6, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonAnimation: {fileID: 466319116} + frameDeltaTime: 0.083333336 + maxFrameSkip: 2 + frameskipMeshUpdate: 1 + timeOffset: 0.033333335 +--- !u!114 &466319116 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + initialFlipX: 0 + initialFlipY: 0 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + addNormals: 0 + calculateTangents: 0 + disableRenderingOnOverride: 1 + _animationName: walk + loop: 1 + timeScale: 1 +--- !u!23 &466319117 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 2 +--- !u!33 &466319118 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Mesh: {fileID: 0} +--- !u!4 &466319119 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -6.71, y: -4.62, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &706647559 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 706647560} + - component: {fileID: 706647562} + - component: {fileID: 706647561} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &706647560 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 706647559} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 767959873} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -411} + m_SizeDelta: {x: 969, y: 93} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &706647561 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 706647559} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 3 + m_MaxSize: 40 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: The Spineboys on the left use SkeletonAnimationFixedTimestep to limit their + update rate. +--- !u!222 &706647562 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 706647559} +--- !u!1 &767959869 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 767959873} + - component: {fileID: 767959872} + - component: {fileID: 767959871} + - component: {fileID: 767959870} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &767959870 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &767959871 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &767959872 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &767959873 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 706647560} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1140995461 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1140995465} + - component: {fileID: 1140995464} + - component: {fileID: 1140995463} + - component: {fileID: 1140995462} + - component: {fileID: 1140995466} + m_Layer: 0 + m_Name: spineboy limited + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1140995462 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + initialFlipX: 0 + initialFlipY: 0 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + addNormals: 0 + calculateTangents: 0 + disableRenderingOnOverride: 1 + _animationName: walk + loop: 1 + timeScale: 1 +--- !u!23 &1140995463 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &1140995464 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Mesh: {fileID: 0} +--- !u!4 &1140995465 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -3.75, y: -3.0900269, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1140995466 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1670ee04b19c794db301d734c71bdd6, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonAnimation: {fileID: 1140995462} + frameDeltaTime: 0.083333336 + maxFrameSkip: 2 + frameskipMeshUpdate: 1 + timeOffset: 0 +--- !u!1 &1660595237 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1660595242} + - component: {fileID: 1660595241} + - component: {fileID: 1660595240} + - component: {fileID: 1660595239} + - component: {fileID: 1660595238} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1660595238 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 +--- !u!124 &1660595239 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 +--- !u!92 &1660595240 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 +--- !u!20 &1660595241 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.56779844, g: 0.6221558, b: 0.6544118, a: 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: 1 + 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_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &1660595242 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1915670692 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1915670697} + - component: {fileID: 1915670696} + - component: {fileID: 1915670695} + - component: {fileID: 1915670694} + - component: {fileID: 1915670693} + m_Layer: 0 + m_Name: spineboy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1915670693 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1670ee04b19c794db301d734c71bdd6, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonAnimation: {fileID: 1915670694} + frameDeltaTime: 0.041666668 + maxFrameSkip: 2 + frameskipMeshUpdate: 1 + timeOffset: 0 +--- !u!114 &1915670694 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + initialFlipX: 0 + initialFlipY: 0 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + addNormals: 0 + calculateTangents: 0 + disableRenderingOnOverride: 1 + _animationName: walk + loop: 1 + timeScale: 1 +--- !u!23 &1915670695 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &1915670696 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Mesh: {fileID: 0} +--- !u!4 &1915670697 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 2.68, y: -3.09, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity.meta b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity.meta new file mode 100644 index 000000000..1ccc74bbd --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48557e58ca94ae740bdbcf7cca4f1cb3 +timeCreated: 1545032603 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs new file mode 100644 index 000000000..65d8b4b3a --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs @@ -0,0 +1,97 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ +using UnityEngine; + +namespace Spine.Unity { + + // To use this example component, add it to your SkeletonAnimation Spine GameObject. + // This component will disable that SkeletonAnimation component to prevent it from calling its own Update and LateUpdate methods. + + [DisallowMultipleComponent] + public sealed class SkeletonAnimationFixedTimestep : MonoBehaviour { + #region Inspector + public SkeletonAnimation skeletonAnimation; + + [Tooltip("The duration of each frame in seconds. For 12 fps: enter '1/12' in the Unity inspector.")] + public float frameDeltaTime = 1 / 15f; + + [Header("Advanced")] + [Tooltip("The maximum number of fixed timesteps. If the game framerate drops below the If the framerate is consistently faster than the limited frames, this does nothing.")] + public int maxFrameSkip = 4; + + [Tooltip("If enabled, the Skeleton mesh will be updated only on the same frame when the animation and skeleton are updated. Disable this or call SkeletonAnimation.LateUpdate yourself if you are modifying the Skeleton using other components that don't run in the same fixed timestep.")] + public bool frameskipMeshUpdate = true; + + [Tooltip("This is the amount the internal accumulator starts with. Set it to some fraction of your frame delta time if you want to stagger updates between multiple skeletons.")] + public float timeOffset; + #endregion + + float accumulatedTime = 0; + bool requiresNewMesh; + + void OnValidate () { + skeletonAnimation = GetComponent(); + if (frameDeltaTime <= 0) frameDeltaTime = 1 / 60f; + if (maxFrameSkip < 1) maxFrameSkip = 1; + } + + void Awake () { + requiresNewMesh = true; + accumulatedTime = timeOffset; + } + + void Update () { + if (skeletonAnimation.enabled) + skeletonAnimation.enabled = false; + + accumulatedTime += Time.deltaTime; + + float frames = 0; + while (accumulatedTime >= frameDeltaTime) { + frames++; + if (frames > maxFrameSkip) break; + accumulatedTime -= frameDeltaTime; + } + + if (frames > 0) { + skeletonAnimation.Update(frames * frameDeltaTime); + requiresNewMesh = true; + } + } + + void LateUpdate () { + if (frameskipMeshUpdate && !requiresNewMesh) return; + + skeletonAnimation.LateUpdate(); + requiresNewMesh = false; + } + } +} + diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs.meta b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs.meta new file mode 100644 index 000000000..f437d4cfd --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e1670ee04b19c794db301d734c71bdd6 +timeCreated: 1545031871 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat index afe2ac7f2..367d88d06 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat index 53e0ab476..0694b83dd 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat index 3bd4acb92..8e3913b56 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat index 4f13dcbab..1588749c2 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat index 10a8e03e6..498848cc8 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat index 2649ff10d..7cccdb634 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat index 49dcc1e07..76ee21f4d 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat @@ -24,6 +24,7 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: - _Black: {r: 1, g: 0, b: 0, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat index 062647744..18c584648 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat index 418a14f81..b291eb89b 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat @@ -24,6 +24,7 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: - _Black: {r: 0, g: 0, b: 0, a: 0} - _Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat index 9d639058a..0a9ccec76 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat index 89ba93e92..245d684e9 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat @@ -28,6 +28,7 @@ Material: - _Cutoff: 0.1 - _FillPhase: 0 - _RefractionStrength: 0.01 + - _StraightAlphaInput: 0 - _node_3476: 0 m_Colors: - _Black: {r: 0, g: 0, b: 0, a: 0}