[unity] Added root motion unit tests and a root motion manual test scene. Rearranged dir structure for both editor and playmode tests.

This commit is contained in:
Harald Csaszar 2022-08-31 20:13:18 +02:00
parent 87e5a84cff
commit 2fe26facc7
40 changed files with 25570 additions and 0 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5ff63f0361511c0408216680a91a6f89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 654fad9276956484a835f2480266668a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9f6386621ae5c643b5672377952e923
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bf1dab9e8d912844495414992b413a8c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TestCharacterMaterial
friction: 0
bounciness: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee2622cfe329cfa4e9d00d26166bd9a3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 921d5da5c9a6f77429fcd828d5facaab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,98 @@
raptor-pro.png
size:2017,918
filter:Linear,Linear
pma:true
back-arm
bounds:1772,17,91,48
offsets:0,0,91,49
back-bracer
bounds:1481,34,77,55
back-hand
bounds:1407,21,72,68
back-knee
bounds:1902,69,97,134
back-thigh
bounds:1018,125,78,47
eyes-open
bounds:719,17,93,89
front-arm
bounds:402,14,96,51
front-bracer
bounds:1347,15,81,58
rotate:90
front-hand
bounds:1018,41,82,75
rotate:90
front-open-hand
bounds:1258,10,86,87
rotate:90
front-thigh
bounds:96,7,114,58
gun
bounds:1577,240,212,206
offsets:0,0,213,206
gun-nohand
bounds:1561,35,209,203
offsets:0,0,210,203
head
bounds:1608,618,271,298
lower-leg
bounds:1413,91,146,189
offsets:0,6,146,195
mouth-grind
bounds:212,6,93,59
mouth-smile
bounds:307,6,93,59
neck
bounds:1865,24,35,41
offsets:0,0,36,41
raptor-back-arm
bounds:844,9,163,172
rotate:90
raptor-body
bounds:2,451,1264,465
raptor-front-arm
bounds:1413,282,162,203
raptor-front-leg
bounds:2,67,382,514
rotate:90
raptor-hindleg-back
bounds:1268,487,338,429
raptor-horn
bounds:1098,86,363,158
offsets:0,0,363,159
rotate:90
raptor-horn-back
bounds:1258,98,351,153
rotate:90
raptor-jaw
bounds:844,174,252,275
raptor-jaw-tooth
bounds:2,2,63,92
offsets:7,4,73,96
rotate:90
raptor-mouth-inside
bounds:1095,2,71,82
raptor-saddle-strap-back
bounds:1907,205,108,148
raptor-saddle-strap-front
bounds:1791,257,114,189
raptor-saddle-w-shadow
bounds:518,108,324,341
raptor-tail-shadow
bounds:1881,539,377,126
rotate:90
raptor-tongue
bounds:1772,67,171,128
rotate:90
stirrup-back
bounds:1168,15,87,69
stirrup-front
bounds:518,17,89,100
rotate:90
stirrup-strap
bounds:620,15,97,91
torso
bounds:1907,355,108,182
visor
bounds:1608,448,261,168

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d2fce08733a866d408a5b9ca41fe41af
timeCreated: 1591122087
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ab6d7df3cf5201f40a3d3b39bac9ac33
timeCreated: 1591122087
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 11b70d61196bc214391853c42a46cb93
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
fileFormatVersion: 2
guid: bd3dd8d509158df4b8cdb69891123217
timeCreated: 1591122088
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6b194f808b1af6499c93410e504af42, type: 3}
m_Name: raptor-pro_Atlas
m_EditorClassIdentifier:
atlasFile: {fileID: 4900000, guid: d2fce08733a866d408a5b9ca41fe41af, type: 3}
materials:
- {fileID: 2100000, guid: bda53dc0ad1672f4cadf3b25031d290d, type: 2}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 988cd03286a74004d841674b6b372c3c
timeCreated: 1591122088
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b00f648dcb4a6eb418684825750c7f44
timeCreated: 1591122106
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: raptor-pro_Material
m_Shader: {fileID: 4800000, guid: 1e8a610c9e01c3648bac42585e5fc676, type: 3}
m_ShaderKeywords: _USE8NEIGHBOURHOOD_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: bd3dd8d509158df4b8cdb69891123217, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Cutoff: 0.1
- _OutlineMipLevel: 0
- _OutlineReferenceTexWidth: 1024
- _OutlineSmoothness: 1
- _OutlineWidth: 3
- _StencilComp: 8
- _StencilRef: 1
- _StraightAlphaInput: 0
- _ThresholdEnd: 0.25
- _Use8Neighbourhood: 1
m_Colors:
- _OutlineColor: {r: 1, g: 1, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bda53dc0ad1672f4cadf3b25031d290d
timeCreated: 1591122088
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f1b3b4b945939a54ea0b23d3396115fb, type: 3}
m_Name: raptor-pro_SkeletonData
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: 988cd03286a74004d841674b6b372c3c, type: 2}
scale: 0.01
skeletonJSON: {fileID: 4900000, guid: ab6d7df3cf5201f40a3d3b39bac9ac33, type: 3}
isUpgradingBlendModeMaterials: 0
blendModeMaterials:
requiresBlendModeMaterials: 0
applyAdditiveMaterial: 0
additiveMaterials: []
multiplyMaterials: []
screenMaterials: []
skeletonDataModifiers: []
fromAnimation: []
toAnimation: []
duration: []
defaultMix: 0.2
controller: {fileID: 9100000, guid: b00f648dcb4a6eb418684825750c7f44, type: 2}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 39efd43571aba134b96d3b2c805b2bbb
timeCreated: 1591122088
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bac23cb727039c74b8d8840fec841a93
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 21a5c6a2a2f1c73488d397f286be91ab
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a98b88dcb4ecf594296948468096c8b5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 895865989758844479fae85f9528a895
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,642 @@
%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: 9
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: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 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.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 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: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !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
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &122890449
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 122890452}
- component: {fileID: 122890451}
- component: {fileID: 122890450}
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 &122890450
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122890449}
m_Enabled: 1
--- !u!20 &122890451
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122890449}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.8207547, g: 0.8207547, b: 0.8207547, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
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 &122890452
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122890449}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 5.4, z: -41.8}
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 &273154726
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 273154729}
- component: {fileID: 273154728}
- component: {fileID: 273154727}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &273154727
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 273154726}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &273154728
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 273154726}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &273154729
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 273154726}
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: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &654073080
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 654073082}
- component: {fileID: 654073081}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &654073081
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 654073080}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &654073082
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 654073080}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &863851824
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 863851828}
- component: {fileID: 863851827}
- component: {fileID: 863851826}
- component: {fileID: 863851825}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &863851825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &863851826
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &863851827
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
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 &863851828
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
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: 1363438027}
m_Father: {fileID: 0}
m_RootOrder: 3
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 &1363438026
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1363438027}
- component: {fileID: 1363438029}
- component: {fileID: 1363438028}
m_Layer: 5
m_Name: Note
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1363438027
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363438026}
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: 863851828}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -35, y: -73.37669}
m_SizeDelta: {x: -110.712, y: -161.2665}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1363438028
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363438026}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'This scene is just for easier preview and applying the contained prefab.
The
prefab is instantiated by the unit test, started via Window - General - Test
Runner.'
--- !u!222 &1363438029
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363438026}
m_CullTransparentMesh: 1
--- !u!1001 &6724551901292798453
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 992224771, guid: 895865989758844479fae85f9528a895, type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 1746262824, guid: 895865989758844479fae85f9528a895, type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 708850485344201424, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 6724551900104020878, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929288, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Name
value: apply this RootMotionTestPrefabRoot
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.6382912
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalPosition.y
value: 3.5455108
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.21497345
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7637581583264517358, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 895865989758844479fae85f9528a895, type: 3}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 11279de73ef10084aaee4e9029d8bfa7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
{
"name": "spine-unity-playmode-tests",
"rootNamespace": "",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"spine-csharp",
"spine-unity"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 307db75ef1c531743a6835c00cf8b9ab
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b08ca6e1b9219d34e9ee4abeb9560986
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,364 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated September 24, 2021. Replaces all prior versions.
*
* Copyright (c) 2013-2022, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using NUnit.Framework;
using Spine;
using Spine.Unity;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;
public class RootMotionTests {
const float WalkRootMotionVelocity = 9.656f; // value specific to this test animation
const float PositionEpsilon = 0.01f;
GameObject rootGameObject;
SkeletonRootMotion skeletonRootMotion;
SkeletonAnimation skeletonAnimation;
Transform skeletonTransform;
float savedFixedTimeStep;
Vector2 translationDeltaSum = Vector2.zero;
float rotationDeltaSum = 0f;
int loopsComplete = 0;
[UnityTest]
public IEnumerator Test01BasicFunctionality () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "straight-walk");
float lastPositionX = skeletonTransform.position.x;
// root motion shall lead to increasing transform position
for (int i = 0; i < 30; ++i) {
yield return null;
lastPositionX = ExpectIncreasingPositionX(lastPositionX, Time.deltaTime * WalkRootMotionVelocity);
}
// disabling the root motion component shall no longer change the transform
skeletonRootMotion.enabled = false;
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
}
[UnityTest]
public IEnumerator Test02BoneOffsetNoRigidbody () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "straight-walk");
yield return null;
Bone topLevelBone = skeletonAnimation.skeleton.Bones.Items[0];
Bone rootMotionBone = skeletonRootMotion.RootMotionBone;
bool rootMotionIsTopLevelBone = rootMotionBone == topLevelBone;
float lastPositionX = topLevelBone.GetLocalPosition().x;
float lastRootMotionBoneX = rootMotionBone.GetLocalPosition().x;
// with enabled root motion component the top level bone shall no longer change position.
for (int i = 0; i < 15; ++i) {
yield return null;
if (rootMotionIsTopLevelBone)
lastPositionX = ExpectUnchangedLocalBonePositionX(topLevelBone, lastPositionX);
else {
lastPositionX = ExpectDecreasingLocalBonePositionX(topLevelBone, lastPositionX);
lastRootMotionBoneX = ExpectUnchangedLocalBonePositionX(rootMotionBone, lastRootMotionBoneX);
}
}
// disabling the root motion component shall no longer reset the root motion bone
skeletonRootMotion.enabled = false;
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectIncreasingLocalBonePositionX(rootMotionBone, lastPositionX);
}
}
[UnityTest]
public IEnumerator Test03UpdateCallbacks () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "straight-walk");
float lastPositionX = skeletonTransform.position.x;
skeletonRootMotion.ProcessRootMotionOverride -= ProcessRootMotionNoOp;
skeletonRootMotion.ProcessRootMotionOverride += ProcessRootMotionNoOp;
skeletonRootMotion.disableOnOverride = true;
// with disableOnOverride it shall no longer change the transform
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
skeletonRootMotion.disableOnOverride = false;
// with disableOnOverride = false it shall again apply root motion to the transform
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectIncreasingPositionX(lastPositionX, Time.deltaTime * WalkRootMotionVelocity);
}
}
[UnityTest]
public IEnumerator Test04PhysicsUpdateCallbacks2D () {
return TestPhysicsUpdateCallbacks("straight-walk-rigidbody2d");
}
[UnityTest]
public IEnumerator Test05PhysicsUpdateCallbacks3D () {
return TestPhysicsUpdateCallbacks("straight-walk-rigidbody3d");
}
public IEnumerator TestPhysicsUpdateCallbacks (string gameObjectName) {
SetupLoadingPrefab("RootMotionTestPrefabRoot", gameObjectName);
float lastPositionX = skeletonTransform.position.x;
skeletonRootMotion.ProcessRootMotionOverride -= ProcessRootMotionNoOp;
skeletonRootMotion.ProcessRootMotionOverride += ProcessRootMotionNoOp;
skeletonRootMotion.PhysicsUpdateRootMotionOverride -= ProcessRootMotionNoOp;
skeletonRootMotion.PhysicsUpdateRootMotionOverride += ProcessRootMotionNoOp;
skeletonRootMotion.disableOnOverride = true;
Debug.Log("Testing physics update with animation timing InUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InUpdate;
yield return new WaitForFixedUpdate();
yield return null;
lastPositionX = skeletonTransform.position.x;
// a rigidbody is assigned, disableOnOverride shall disable applying root motion when PhysicsUpdateRootMotionOverride is set
for (int i = 0; i < 3; ++i) {
yield return new WaitForFixedUpdate();
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
// same when using InFixedUpdate
Debug.Log("Testing physics update with animation timing InFixedUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InFixedUpdate;
yield return new WaitForFixedUpdate();
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 3; ++i) {
yield return new WaitForFixedUpdate();
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
Debug.Log("Testing physics update InFixedUpdate with disableOnOverride = false.");
Time.fixedDeltaTime = 0.5f;
skeletonRootMotion.disableOnOverride = false;
skeletonAnimation.UpdateTiming = UpdateTiming.InFixedUpdate;
yield return new WaitForFixedUpdate();
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
yield return new WaitForFixedUpdate();
lastPositionX = ExpectIncreasingPositionX(lastPositionX, Time.deltaTime * WalkRootMotionVelocity);
}
}
[UnityTest]
public IEnumerator Test06CallbackDistancesInUpdate2D () {
return TestCallbackDistancesInUpdate("straight-walk-rigidbody2d");
}
[UnityTest]
public IEnumerator Test07CallbackDistancesInUpdate3D () {
return TestCallbackDistancesInUpdate("straight-walk-rigidbody3d");
}
public IEnumerator TestCallbackDistancesInUpdate (string gameObjectName) {
SetupLoadingPrefab("RootMotionTestPrefabRoot", gameObjectName);
float lastPositionX = skeletonTransform.position.x;
Debug.Log("Testing physics update with animation timing InUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InUpdate;
skeletonRootMotion.disableOnOverride = true;
skeletonRootMotion.ProcessRootMotionOverride -= CumulateDelta;
skeletonRootMotion.ProcessRootMotionOverride += CumulateDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride -= EndAndCompareCumulatedDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride += EndAndCompareCumulatedDelta;
for (int i = 0; i < 30; ++i) {
yield return new WaitForFixedUpdate();
yield return null;
}
Debug.Log("Testing physics update animating InUpdate with very long fixedDeltaTime (physics timestep).");
Time.fixedDeltaTime = 0.5f;
skeletonRootMotion.disableOnOverride = false;
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 6; ++i) { // only few iterations since WaitForFixedUpdate takes 0.5 seconds now!
yield return new WaitForFixedUpdate();
yield return null;
}
}
[UnityTest]
public IEnumerator Test08CallbackDistancesInFixedUpdate2D () {
return TestCallbackDistancesInFixedUpdate("straight-walk-rigidbody2d");
}
[UnityTest]
public IEnumerator Test09CallbackDistancesInFixedUpdate3D () {
return TestCallbackDistancesInFixedUpdate("straight-walk-rigidbody3d");
}
public IEnumerator TestCallbackDistancesInFixedUpdate (string gameObjectName) {
SetupLoadingPrefab("RootMotionTestPrefabRoot", gameObjectName);
float lastPositionX = skeletonTransform.position.x;
Debug.Log("Testing physics update with animation timing InFixedUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InFixedUpdate;
skeletonRootMotion.disableOnOverride = true;
skeletonRootMotion.ProcessRootMotionOverride -= CumulateDelta;
skeletonRootMotion.ProcessRootMotionOverride += CumulateDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride -= EndAndCompareCumulatedDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride += EndAndCompareCumulatedDelta;
// a rigidbody is assigned, disableOnOverride shall disable applying root motion when PhysicsUpdateRootMotionOverride is set
for (int i = 0; i < 30; ++i) {
yield return new WaitForFixedUpdate();
yield return null;
}
Debug.Log("Testing physics update animating InFixedUpdate with very long fixedDeltaTime (physics timestep).");
Time.fixedDeltaTime = 0.5f;
skeletonRootMotion.disableOnOverride = false;
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 6; ++i) { // only few iterations since WaitForFixedUpdate takes 0.5 seconds now!
yield return new WaitForFixedUpdate();
yield return null;
}
}
[UnityTest]
public IEnumerator Test10DeltaCompensation () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "jump-rootmotion");
Transform jumpTarget = GameObject.Find("jump-target").transform;
Time.timeScale = 3;
skeletonAnimation.AnimationState.Complete += OnLoopComplete;
yield return null;
for (int i = 0; i < 600 && loopsComplete == 0; ++i) {
// note: done via existing example component now.
// Vector3 toTarget = jumpTarget.position - skeletonTransform.position;
// skeletonRootMotion.AdjustRootMotionToDistance(toTarget);
yield return null;
}
Assert.AreEqual(1, loopsComplete);
Assert.AreEqual(jumpTarget.transform.position.x, skeletonTransform.position.x, PositionEpsilon);
}
public void OnLoopComplete (TrackEntry trackEntry) {
++loopsComplete;
}
GameObject SetupLoadingPrefab (string prefabAssetName, string skeletonObjectName) {
GameObject prefab = Resources.Load<GameObject>(prefabAssetName);
rootGameObject = MonoBehaviour.Instantiate(prefab);
Assert.IsNotNull(rootGameObject);
GameObject straightWalkObject = GameObject.Find(skeletonObjectName);
Assert.IsNotNull(straightWalkObject);
skeletonTransform = straightWalkObject.transform;
skeletonAnimation = straightWalkObject.GetComponent<SkeletonAnimation>();
skeletonRootMotion = skeletonAnimation.GetComponent<SkeletonRootMotion>();
Assert.IsNotNull(skeletonAnimation);
Assert.IsNotNull(skeletonRootMotion);
return rootGameObject;
}
[UnitySetUp]
public IEnumerator SetUp () {
savedFixedTimeStep = Time.fixedDeltaTime;
translationDeltaSum = Vector2.zero;
rotationDeltaSum = 0f;
yield return null;
}
[UnityTearDown]
public IEnumerator TearDown () {
Time.timeScale = 1;
Time.fixedDeltaTime = savedFixedTimeStep;
GameObject.Destroy(rootGameObject);
yield return null;
}
void ProcessRootMotionNoOp (SkeletonRootMotionBase component, Vector2 translation, float rotation) {
}
void CumulateDelta (SkeletonRootMotionBase component, Vector2 translationDelta, float rotationDelta) {
translationDeltaSum += translationDelta;
rotationDeltaSum += rotationDelta;
Debug.Log(" Accumulating movement delta for later comparison. Single delta: " + translationDelta);
}
void EndAndCompareCumulatedDelta (SkeletonRootMotionBase component, Vector2 cumulatedTranslation, float cumulatedRotation) {
Debug.Log(" Cumulated movement delta from callback: " + cumulatedTranslation);
Assert.AreEqual(translationDeltaSum.x, cumulatedTranslation.x);
Assert.AreEqual(translationDeltaSum.y, cumulatedTranslation.y);
Assert.AreEqual(rotationDeltaSum, cumulatedRotation);
translationDeltaSum = Vector2.zero;
rotationDeltaSum = 0f;
Debug.Log(" Successfully compared cumulated delta.");
}
float ExpectUnchangedPositionX (float lastPositionX) {
float positionX = skeletonTransform.position.x;
Assert.AreEqual(positionX, lastPositionX);
return positionX;
}
float ExpectIncreasingPositionX (float lastPositionX, float difference) {
float positionX = skeletonTransform.position.x;
Assert.Greater(positionX, lastPositionX);
//Debug.Log(string.Format("positionX {0}, lastPositionX {1}, deltatime {2}.", positionX, lastPositionX, Time.deltaTime));
Assert.AreEqual(lastPositionX + difference, positionX, PositionEpsilon);
return positionX;
}
float ExpectUnchangedLocalBonePositionX (Bone bone, float lastPositionX) {
float positionX = bone.GetLocalPosition().x;
Assert.AreEqual(positionX, lastPositionX);
return positionX;
}
float ExpectIncreasingLocalBonePositionX (Bone bone, float lastPositionX) {
float positionX = bone.GetLocalPosition().x;
Assert.Greater(positionX, lastPositionX);
return positionX;
}
float ExpectDecreasingLocalBonePositionX (Bone bone, float lastPositionX) {
float positionX = bone.GetLocalPosition().x;
Assert.Less(positionX, lastPositionX);
return positionX;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e047bb9d2c2a66b4392a0589cb3a7aa8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: