Add assets
This commit is contained in:
8
Assets/Cainos/Common/Script.meta
Normal file
8
Assets/Cainos/Common/Script.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c08792f654687f49860e6f2fdd385c5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Cainos/Common/Script/Utils.meta
Normal file
8
Assets/Cainos/Common/Script/Utils.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e1857fb5adc1744885c19f73a68a869
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
133
Assets/Cainos/Common/Script/Utils/SecondOrderDynamics.cs
Normal file
133
Assets/Cainos/Common/Script/Utils/SecondOrderDynamics.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
//https://www.youtube.com/watch?v=KPoeNZZ6H4s
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cainos.Common
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct SecondOrderDynamics
|
||||
{
|
||||
private Vector3 xp;
|
||||
private Vector3 y, yd;
|
||||
private float k1, k2, k3;
|
||||
private Vector3 xd;
|
||||
|
||||
private float k2_stable;
|
||||
|
||||
[SerializeField] private float f;
|
||||
[SerializeField] private float d;
|
||||
[SerializeField] private float r;
|
||||
|
||||
public float Frequency
|
||||
{
|
||||
get { return f; }
|
||||
set
|
||||
{
|
||||
if (value <= 0.01f) value = 0.01f;
|
||||
|
||||
f = value;
|
||||
UpdateInnerParams();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public float Damping
|
||||
{
|
||||
get { return d; }
|
||||
set
|
||||
{
|
||||
if (value <= 0.01f) value = 0.01f;
|
||||
|
||||
d = value;
|
||||
UpdateInnerParams();
|
||||
}
|
||||
}
|
||||
|
||||
public float Response
|
||||
{
|
||||
get { return r; }
|
||||
set
|
||||
{
|
||||
r = value;
|
||||
UpdateInnerParams();
|
||||
}
|
||||
}
|
||||
|
||||
public SecondOrderDynamics(float frequency, float damping, float response)
|
||||
{
|
||||
this.f = 1.0f;
|
||||
this.d = 0.0f;
|
||||
this.r = 0.0f;
|
||||
xp = Vector3.zero;
|
||||
y = Vector3.zero;
|
||||
xd = Vector3.zero;
|
||||
yd = Vector3.zero;
|
||||
k1 = 0.0f;
|
||||
k2 = 0.0f;
|
||||
k3 = 0.0f;
|
||||
k2_stable = 0.0f;
|
||||
|
||||
Reset(frequency, damping, response, Vector3.zero);
|
||||
}
|
||||
|
||||
public void Reset(float frequency, float damping, float response, Vector3 x0)
|
||||
{
|
||||
f = frequency;
|
||||
d = damping;
|
||||
r = response;
|
||||
|
||||
xp = x0;
|
||||
y = x0;
|
||||
xd = Vector3.zero;
|
||||
yd = Vector3.zero;
|
||||
|
||||
UpdateInnerParams();
|
||||
}
|
||||
|
||||
public void Reset(Vector3 x0)
|
||||
{
|
||||
Reset(f, d, r, x0);
|
||||
}
|
||||
|
||||
public void Reset(Vector2 x0)
|
||||
{
|
||||
Reset(f, d, r, x0);
|
||||
}
|
||||
|
||||
public void Reset(float x0)
|
||||
{
|
||||
Reset(f, d, r, Vector3.one * x0);
|
||||
}
|
||||
|
||||
public Vector3 Update(Vector3 x, float t)
|
||||
{
|
||||
if (t < Mathf.Epsilon) return y;
|
||||
|
||||
xd = (x - xp) / t;
|
||||
xp = x;
|
||||
|
||||
k2_stable = Mathf.Max(k2, 1.1f * (t * t * 0.25f + t * k1 * 0.5f));
|
||||
y += t * yd;
|
||||
yd += t * (x + k3 * xd - y - k1 * yd) / k2_stable;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
public Vector2 Update(Vector2 x, float t)
|
||||
{
|
||||
return Update(new Vector3(x.x,x.y,0.0f), t);
|
||||
}
|
||||
|
||||
public float Update(float x, float t)
|
||||
{
|
||||
return Update(Vector3.one * x, t).x;
|
||||
}
|
||||
|
||||
private void UpdateInnerParams()
|
||||
{
|
||||
k1 = d / (Mathf.PI * f);
|
||||
k2 = 1.0f / ((2.0f * Mathf.PI * f) * (2.0f * Mathf.PI * f));
|
||||
k3 = r * d / (2.0f * Mathf.PI * f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2534c9c5f1c7abc46893edf3791a98cd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Cainos/Common/Texture.meta
Normal file
8
Assets/Cainos/Common/Texture.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9edc9a0912b514f4e96366ca9b1aab9f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Cainos/Common/Texture/Utils.meta
Normal file
8
Assets/Cainos/Common/Texture/Utils.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4866c9c87e6f2b479013c1e0ac75abc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Cainos/Common/Texture/Utils/TX Utils Checker.png
Normal file
BIN
Assets/Cainos/Common/Texture/Utils/TX Utils Checker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
159
Assets/Cainos/Common/Texture/Utils/TX Utils Checker.png.meta
Normal file
159
Assets/Cainos/Common/Texture/Utils/TX Utils Checker.png.meta
Normal file
@@ -0,0 +1,159 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f38ccca1cb4ef644b486a69e9cef663
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 32
|
||||
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
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 3
|
||||
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
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
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: WebGL
|
||||
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: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 3
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user