forked from cgvr/DeltaVR
add separate sprites for animatable mouths for characters, improve animating params
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
* archery range:
|
||||
* kui midagi laeb (wire aktiivne), siis particle'id võiks voolata mööda toru
|
||||
* highscore json tühjaks
|
||||
* cafe:
|
||||
* robert on plekiline, vunts õiget värvi :)
|
||||
* quest marker järjest järgmise tegevuse kohal: mikrofon, siis nupud
|
||||
* character billboard:
|
||||
* tulnukale korraliku resolutsiooniga suu / silm liikuma
|
||||
|
||||
BIN
Assets/_PROJECT/Images/Characters/alien.png
LFS
Normal file
BIN
Assets/_PROJECT/Images/Characters/alien.png
LFS
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6c8339abbe148d41922111b7cb9864b
|
||||
guid: dacaf626e1eb2bb478bf29b2f9998859
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
BIN
Assets/_PROJECT/Images/Characters/alien_eye.png
LFS
Normal file
BIN
Assets/_PROJECT/Images/Characters/alien_eye.png
LFS
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cd0596f37c5d844293f7a3e27f206de
|
||||
guid: 71b65d0b682024048bc5932f3b32f810
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ace7b466e839d9141a22fb265a7f4dab
|
||||
guid: 49dc94a1246ace944adb973076dd923f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
||||
BIN
Assets/_PROJECT/Images/Characters/professor_mouth.png
LFS
Normal file
BIN
Assets/_PROJECT/Images/Characters/professor_mouth.png
LFS
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e1109ed0698828469be212e037d25a8
|
||||
guid: d6cb08bc045869645a782eb599897dbb
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17982223378702040a834df4caad3f72
|
||||
guid: 2c3b765a5860a8d4e81d47f2d7041678
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
||||
BIN
Assets/_PROJECT/Images/Characters/robert_moustache.png
LFS
Normal file
BIN
Assets/_PROJECT/Images/Characters/robert_moustache.png
LFS
Normal file
Binary file not shown.
148
Assets/_PROJECT/Images/Characters/robert_moustache.png.meta
Normal file
148
Assets/_PROJECT/Images/Characters/robert_moustache.png.meta
Normal file
@@ -0,0 +1,148 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a603a6b2c8b06446a6507224855545d
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
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
|
||||
swizzle: 50462976
|
||||
cookieLightType: 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
|
||||
- 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: Windows Store Apps
|
||||
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: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -67,7 +67,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: d6c8339abbe148d41922111b7cb9864b, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: dacaf626e1eb2bb478bf29b2f9998859, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -166,7 +166,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
m_PresetInfoIsWorld: 1
|
||||
--- !u!114 &6105090838799004608
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -196,14 +196,20 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: ea1b6453c1ef8e24d921a6dbaa549eba, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mouthTransform: {fileID: 5759406807219530703}
|
||||
mouthScalingMultiplier: 2.5
|
||||
mouthMovementDuration: 0.25
|
||||
voicelinesFolder: CharacterVoicelines
|
||||
characterSpecificFolder:
|
||||
voiceLineKeys:
|
||||
- Alien/Madis_Look2
|
||||
- Alien/Madis_Mic_Speak1
|
||||
- Alien/Madis_Button_Press2
|
||||
-
|
||||
mouth: {fileID: 5759406807219530703}
|
||||
minScaleY: 1
|
||||
maxScaleY: 9.7
|
||||
gain: 60
|
||||
attack: 0.6
|
||||
release: 0.2
|
||||
inverted: 1
|
||||
--- !u!114 &7699707098595015193
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -483,7 +489,7 @@ GameObject:
|
||||
- component: {fileID: 7165916293981694318}
|
||||
- component: {fileID: 6022352331462232051}
|
||||
m_Layer: 0
|
||||
m_Name: Mouth
|
||||
m_Name: Eye
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -498,7 +504,7 @@ RectTransform:
|
||||
m_GameObject: {fileID: 7802421088258943189}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -0}
|
||||
m_LocalScale: {x: 4.2348323, y: 4.2348323, z: 4.2348323}
|
||||
m_LocalScale: {x: 9.72016, y: 9.72016, z: 9.72016}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6822286665445551211}
|
||||
@@ -506,7 +512,7 @@ RectTransform:
|
||||
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: 82, y: -129}
|
||||
m_AnchoredPosition: {x: 57, y: 384}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7165916293981694318
|
||||
@@ -537,7 +543,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 4e1109ed0698828469be212e037d25a8, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 71b65d0b682024048bc5932f3b32f810, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
||||
@@ -67,7 +67,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 17982223378702040a834df4caad3f72, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 2c3b765a5860a8d4e81d47f2d7041678, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -205,11 +205,12 @@ MonoBehaviour:
|
||||
- Ulrich_Terribly_Sorry_1
|
||||
- Ulrich_Enjoy
|
||||
mouth: {fileID: 5759406807219530703}
|
||||
minScaleY: 0.3
|
||||
maxScaleY: 1
|
||||
minScaleY: 1
|
||||
maxScaleY: 1.75
|
||||
gain: 30
|
||||
attack: 0.6
|
||||
release: 0.2
|
||||
inverted: 0
|
||||
fmodWhisperBridge: {fileID: 0}
|
||||
notepadText: {fileID: 0}
|
||||
notepad: {fileID: 0}
|
||||
@@ -496,7 +497,7 @@ GameObject:
|
||||
- component: {fileID: 7165916293981694318}
|
||||
- component: {fileID: 6022352331462232051}
|
||||
m_Layer: 0
|
||||
m_Name: Mouth
|
||||
m_Name: Moustache
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -511,7 +512,7 @@ RectTransform:
|
||||
m_GameObject: {fileID: 7802421088258943189}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 2.7376072, y: 2.7376072, z: 2.7376072}
|
||||
m_LocalScale: {x: 3.2457073, y: 1, z: 3.2457073}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6822286665445551211}
|
||||
@@ -519,7 +520,7 @@ RectTransform:
|
||||
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: -40, y: 502}
|
||||
m_AnchoredPosition: {x: -32, y: 509}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7165916293981694318
|
||||
@@ -550,7 +551,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 4e1109ed0698828469be212e037d25a8, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 5a603a6b2c8b06446a6507224855545d, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
||||
Binary file not shown.
@@ -22,6 +22,7 @@ public abstract class NPCController : MonoBehaviour
|
||||
public float gain = 30f; // multiply RMS to make mouth open larger
|
||||
public float attack = 0.6f; // faster opening
|
||||
public float release = 0.2f; // slower closing
|
||||
public bool inverted = false;
|
||||
|
||||
private float[] rmsCurve;
|
||||
private EventInstance currentVoicelineEvent;
|
||||
@@ -72,8 +73,17 @@ public abstract class NPCController : MonoBehaviour
|
||||
|
||||
float amp = rmsCurve[index] * gain;
|
||||
|
||||
// Normal mapping: louder -> larger scale
|
||||
float mapped = Mathf.Clamp(minScaleY + amp, minScaleY, maxScaleY);
|
||||
|
||||
// Inverted mapping: louder -> smaller scale
|
||||
// Achieve this by mirroring within [min, max]:
|
||||
// invertedTarget = min + (max - (min + amp)) = min + (max - min) - amp
|
||||
// equivalently:
|
||||
float invertedTarget = Mathf.Clamp(minScaleY + (maxScaleY - minScaleY) - (mapped - minScaleY), minScaleY, maxScaleY);
|
||||
float targetY = inverted ? invertedTarget : mapped;
|
||||
|
||||
// attack/release smoothing
|
||||
float targetY = Mathf.Clamp(minScaleY + amp, minScaleY, maxScaleY);
|
||||
if (targetY > smoothed)
|
||||
smoothed = Mathf.Lerp(smoothed, targetY, attack);
|
||||
else
|
||||
@@ -84,21 +94,21 @@ public abstract class NPCController : MonoBehaviour
|
||||
s.y = smoothed;
|
||||
Debug.Log("mouth scale: " + smoothed);
|
||||
mouth.localScale = s;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void StopSpeaking()
|
||||
{
|
||||
isSpeaking = false;
|
||||
smoothed = minScaleY;
|
||||
smoothed = inverted ? maxScaleY : minScaleY;
|
||||
|
||||
if (mouth != null)
|
||||
{
|
||||
var scale = mouth.localScale;
|
||||
scale.y = minScaleY;
|
||||
scale.y = smoothed;
|
||||
mouth.localScale = scale;
|
||||
}
|
||||
Debug.Log("mouth scale stopped: " + smoothed);
|
||||
|
||||
currentVoicelineEvent.release();
|
||||
}
|
||||
@@ -148,7 +158,7 @@ public abstract class NPCController : MonoBehaviour
|
||||
|
||||
// Stop mouth on end
|
||||
float voicelineDuration = rmsCurve.Length * FRAME_DURATION;
|
||||
Invoke(nameof(StopSpeaking), voicelineDuration);
|
||||
Invoke(nameof(StopSpeaking), voicelineDuration + 0.1f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user