동글 운항

This commit is contained in:
2026-06-19 18:16:40 +09:00
parent 790e958b0a
commit 5b14d51884
22 changed files with 1225 additions and 33 deletions

Binary file not shown.

View File

@@ -9,7 +9,7 @@ public class RaftRiverController : MonoBehaviour
[Header("Steering Input")]
[SerializeField] private SteeringKeyXR steeringKey;
[Tooltip("체크하면 키 움직임과 반대로 뗏목이 좌우 이동합니다.")]
[Tooltip("Invert left/right steering input.")]
[SerializeField] private bool reverseControl = true;
[Header("Move Speed")]
@@ -20,7 +20,7 @@ public class RaftRiverController : MonoBehaviour
[SerializeField] private float sideMoveSpeed = 16f;
[SerializeField] private float sideAcceleration = 40f;
[Tooltip("강 중앙선 기준 좌우 이동 가능 범위입니다. 동굴 폭 46이면 14~16 추천.")]
[Tooltip("Maximum side movement from the raft center line.")]
[SerializeField] private float maxSideOffset = 16f;
[Header("Path Follow Feel")]
@@ -29,8 +29,14 @@ public class RaftRiverController : MonoBehaviour
[SerializeField] private float rotationVelocityBlend = 0.45f;
[SerializeField] private float steeringYawAngle = 18f;
[Header("Manual Steering")]
[Tooltip("Degrees per second SteeringKeyXR can turn the raft travel direction while held.")]
[SerializeField] private float grabbedSteeringTurnSpeed = 75f;
[Header("Arrival")]
[SerializeField] private float pointReachDistance = 1.5f;
[SerializeField] private float arrivalSlowDownDistance = 12f;
[SerializeField] private float arrivalMinSpeed = 0.8f;
[Header("Events")]
public UnityEvent onArrived;
@@ -45,6 +51,7 @@ public class RaftRiverController : MonoBehaviour
private Vector3 currentRight;
private Vector3 positionSmoothVelocity;
private Vector3 previousPosition;
private Vector3 startCenterPosition;
private bool isFinished = false;
private bool warnedMissingSteeringKey;
@@ -62,18 +69,16 @@ private void Start()
if (pathPoints == null || pathPoints.Length == 0)
{
Debug.LogWarning("[RaftRiverController] Path Points가 비어 있습니다.", this);
Debug.LogWarning("[RaftRiverController] Path Points are empty.", this);
enabled = false;
return;
}
currentCenterPosition = transform.position;
startCenterPosition = currentCenterPosition;
currentForward = transform.forward;
currentRight = transform.right;
previousPosition = transform.position;
// 첫 목표 지점은 0번이 아니라 1번부터 가는 것이 자연스러울 때가 많음.
// 단, 0번이 현재 위치와 다르면 그대로 0번부터 이동.
currentPointIndex = 0;
}
@@ -82,8 +87,8 @@ private void Update()
if (isFinished)
return;
MoveAlongPath();
HandleSideControl();
MoveAlongPath();
ApplyRaftPositionAndRotation();
}
@@ -91,41 +96,59 @@ private void MoveAlongPath()
{
SkipMissingPathPoints();
if (currentPointIndex >= pathPoints.Length)
int lastPointIndex = GetLastValidPathPointIndex();
if (lastPointIndex < 0 || currentPointIndex >= pathPoints.Length)
{
FinishRaftRide();
return;
}
Transform targetPoint = pathPoints[currentPointIndex];
Vector3 toTarget = targetPoint.position - currentCenterPosition;
toTarget.y = 0f;
Vector3 toTarget = GetFlatVectorTo(targetPoint.position);
float distance = toTarget.magnitude;
bool isLastTarget = currentPointIndex == lastPointIndex;
if (distance < pointReachDistance)
while (!isLastTarget && ShouldAdvancePathPoint(currentPointIndex, distance))
{
currentPointIndex++;
SkipMissingPathPoints();
if (currentPointIndex >= pathPoints.Length)
{
SnapToPathPoint(targetPoint);
FinishRaftRide();
return;
}
targetPoint = pathPoints[currentPointIndex];
toTarget = targetPoint.position - currentCenterPosition;
toTarget.y = 0f;
toTarget = GetFlatVectorTo(targetPoint.position);
distance = toTarget.magnitude;
isLastTarget = currentPointIndex == lastPointIndex;
}
if (isLastTarget && distance <= pointReachDistance)
{
SnapToPathPoint(targetPoint);
FinishRaftRide();
return;
}
if (toTarget.sqrMagnitude < 0.001f)
return;
currentForward = toTarget.normalized;
currentCenterPosition += currentForward * forwardSpeed * Time.deltaTime;
Vector3 pathForward = toTarget.normalized;
currentForward = GetTravelForward(pathForward);
float currentSpeed = GetCurrentForwardSpeed(distance);
float moveDistance = currentSpeed * Time.deltaTime;
// 진행 방향 기준 오른쪽 벡터
if (isLastTarget && moveDistance >= distance)
{
SnapToPathPoint(targetPoint);
FinishRaftRide();
return;
}
currentCenterPosition += currentForward * moveDistance;
currentRight = Vector3.Cross(Vector3.up, currentForward).normalized;
}
@@ -145,15 +168,12 @@ private void HandleSideControl()
if (!warnedMissingSteeringKey)
{
warnedMissingSteeringKey = true;
Debug.LogWarning("[RaftRiverController] SteeringKeyXR 참조가 없어 좌우 조향 없이 전진합니다.", this);
Debug.LogWarning("[RaftRiverController] SteeringKeyXR reference is missing. Falling back to legacy horizontal input.", this);
}
}
// 반전은 여기서만 처리
if (reverseControl)
{
input *= -1f;
}
currentSteeringInput = input;
@@ -179,8 +199,6 @@ private void ApplyRaftPositionAndRotation()
previousPosition = transform.position;
Vector3 targetPosition = currentCenterPosition + currentRight * sideOffset;
// 현재 뗏목 높이 유지
targetPosition.y = transform.position.y;
float smoothTime = Mathf.Max(0.01f, pathFollowSmoothTime);
@@ -225,8 +243,7 @@ private void FinishRaftRide()
isFinished = true;
Debug.Log("[RaftRiverController] 목적지 도착. 뗏목 정지.");
Debug.Log("[RaftRiverController] Arrived at destination. Raft stopped.");
onArrived?.Invoke();
}
@@ -254,6 +271,170 @@ private void ResolveSteeringKey()
steeringKey = GetComponentInChildren<SteeringKeyXR>(true);
}
private Vector3 GetTravelForward(Vector3 fallbackForward)
{
Vector3 travelForward = currentForward;
travelForward.y = 0f;
if (travelForward.sqrMagnitude < 0.001f)
travelForward = transform.forward;
travelForward.y = 0f;
if (travelForward.sqrMagnitude < 0.001f)
travelForward = fallbackForward;
if (steeringKey != null && steeringKey.IsGrabbed)
{
float turnAmount = currentSteeringInput * Mathf.Max(0f, grabbedSteeringTurnSpeed) * Time.deltaTime;
travelForward = Quaternion.Euler(0f, turnAmount, 0f) * travelForward.normalized;
}
return travelForward.normalized;
}
private Vector3 GetFlatVectorTo(Vector3 worldPosition)
{
Vector3 delta = worldPosition - currentCenterPosition;
delta.y = 0f;
return delta;
}
private bool ShouldAdvancePathPoint(int targetIndex, float distanceToTarget)
{
return distanceToTarget < pointReachDistance || HasPassedPathPoint(targetIndex);
}
private bool HasPassedPathPoint(int targetIndex)
{
if (pathPoints == null || targetIndex < 0 || targetIndex >= pathPoints.Length || pathPoints[targetIndex] == null)
return true;
Vector3 anchorPosition = GetPreviousPathAnchorPosition(targetIndex);
Vector3 targetPosition = pathPoints[targetIndex].position;
anchorPosition.y = currentCenterPosition.y;
targetPosition.y = currentCenterPosition.y;
Vector3 segment = targetPosition - anchorPosition;
if (segment.sqrMagnitude < 0.001f)
return false;
Vector3 fromAnchor = currentCenterPosition - anchorPosition;
fromAnchor.y = 0f;
return Vector3.Dot(fromAnchor, segment.normalized) >= segment.magnitude;
}
private Vector3 GetPreviousPathAnchorPosition(int targetIndex)
{
if (pathPoints != null)
{
for (int i = targetIndex - 1; i >= 0; i--)
{
if (pathPoints[i] != null)
return pathPoints[i].position;
}
}
return startCenterPosition;
}
private void SnapToPathPoint(Transform point)
{
if (point == null)
return;
Vector3 finalPosition = point.position;
finalPosition.y = transform.position.y;
currentCenterPosition = finalPosition;
sideOffset = 0f;
sideVelocity = 0f;
currentSteeringInput = 0f;
positionSmoothVelocity = Vector3.zero;
previousPosition = finalPosition;
transform.position = finalPosition;
}
private int GetPenultimateValidPathPointIndex()
{
if (pathPoints == null)
return -1;
int lastValidIndex = -1;
for (int i = pathPoints.Length - 1; i >= 0; i--)
{
if (pathPoints[i] == null)
continue;
if (lastValidIndex < 0)
{
lastValidIndex = i;
continue;
}
return i;
}
return lastValidIndex;
}
private float GetArrivalSlowDownDistance()
{
float fallbackDistance = Mathf.Max(pointReachDistance + 0.01f, arrivalSlowDownDistance);
int penultimateIndex = GetPenultimateValidPathPointIndex();
int lastPointIndex = GetLastValidPathPointIndex();
if (penultimateIndex < 0 || lastPointIndex < 0 || penultimateIndex == lastPointIndex)
return fallbackDistance;
Vector3 penultimatePosition = pathPoints[penultimateIndex].position;
Vector3 finalPosition = pathPoints[lastPointIndex].position;
penultimatePosition.y = 0f;
finalPosition.y = 0f;
float finalSegmentDistance = Vector3.Distance(penultimatePosition, finalPosition);
if (finalSegmentDistance <= pointReachDistance)
return fallbackDistance;
return Mathf.Max(pointReachDistance + 0.01f, finalSegmentDistance);
}
private float GetCurrentForwardSpeed(float distanceToTarget)
{
if (currentPointIndex != GetLastValidPathPointIndex())
return forwardSpeed;
float maxSpeed = Mathf.Max(0f, forwardSpeed);
if (maxSpeed <= 0.01f)
return maxSpeed;
float slowDownDistance = GetArrivalSlowDownDistance();
if (slowDownDistance <= pointReachDistance)
return maxSpeed;
float minSpeed = Mathf.Clamp(arrivalMinSpeed, 0.01f, maxSpeed);
float speedRatio = Mathf.InverseLerp(pointReachDistance, slowDownDistance, distanceToTarget);
speedRatio = speedRatio * speedRatio * (3f - 2f * speedRatio);
return Mathf.Lerp(minSpeed, maxSpeed, speedRatio);
}
private int GetLastValidPathPointIndex()
{
if (pathPoints == null)
return -1;
for (int i = pathPoints.Length - 1; i >= 0; i--)
{
if (pathPoints[i] != null)
return i;
}
return -1;
}
private void SkipMissingPathPoints()
{
while (currentPointIndex < pathPoints.Length && pathPoints[currentPointIndex] == null)

View File

@@ -7,6 +7,8 @@ public class SteeringKeyXR : MonoBehaviour
[Header("References")]
[SerializeField] private XRGrabInteractable grabInteractable;
[SerializeField] private Transform keyPivot;
[SerializeField] private Transform handPoseRoot;
[SerializeField] private bool keepHandPoseRootOnKeyPivot = true;
[Header("Steering")]
[SerializeField] private float maxAngle = 45f;
@@ -33,18 +35,24 @@ public float SteeringValue
}
}
public bool IsGrabbed => isGrabbed;
private void Awake()
{
if (keyPivot == null)
keyPivot = transform;
ResolveGrabInteractable();
ResolveHandPoseRoot();
ParentHandPoseRootToKeyPivot();
initialPivotRotation = keyPivot.localRotation;
}
private void OnEnable()
{
ResolveGrabInteractable();
ResolveHandPoseRoot();
ParentHandPoseRootToKeyPivot();
if (grabInteractable != null)
{
@@ -114,6 +122,26 @@ private Vector3 GetInitialPivotSpaceDirection(Vector3 worldDirection)
return Quaternion.Inverse(referenceRotation) * worldDirection;
}
private void ResolveHandPoseRoot()
{
if (handPoseRoot != null)
return;
handPoseRoot = transform.Find("HandPoser");
}
private void ParentHandPoseRootToKeyPivot()
{
if (!keepHandPoseRootOnKeyPivot || keyPivot == null || handPoseRoot == null)
return;
if (handPoseRoot == keyPivot || handPoseRoot.parent == keyPivot)
return;
handPoseRoot.SetParent(keyPivot, true);
}
private void ResolveGrabInteractable()
{
if (grabInteractable != null)

View File

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

View File

@@ -0,0 +1,133 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-5762510348686555522
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WhiteRhino_Skelmesh|Rhino_Combat_Atk_Hit
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -6965996446633848512, guid: 92d682043cfdbf74eb2ba7e97f315570, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-4310578917768360520
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: isIdle
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -5762510348686555522}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.95
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &-2980947776084645954
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 2482721225991305447}
m_Position: {x: 330, y: 310, z: 0}
- serializedVersion: 1
m_State: {fileID: -5762510348686555522}
m_Position: {x: 670, y: 290, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 2482721225991305447}
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Animator Controller
serializedVersion: 5
m_AnimatorParameters:
- m_Name: isIdle
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -2980947776084645954}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &2482721225991305447
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WhiteRhino_Skelmesh|AA_WhiteRhino_Loco_Idle_Normal
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -4310578917768360520}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 25037590874517032, guid: 92d682043cfdbf74eb2ba7e97f315570, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:

View File

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

View File

@@ -0,0 +1,28 @@
fileFormatVersion: 2
guid: 92d682043cfdbf74eb2ba7e97f315570
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 715df9372183c47e389bb6e19fbc3b52, type: 3}
editorImportSettings:
generateSecondaryUVSet: 0
importSettings:
nodeNameMethod: 1
animationMethod: 2
generateMipMaps: 1
texturesReadable: 0
defaultMinFilterMode: 9729
defaultMagFilterMode: 9729
anisotropicFilterLevel: 1
instantiationSettings:
mask: -1
layer: 0
skinUpdateWhenOffscreen: 1
lightIntensityFactor: 1
sceneObjectCreation: 2
assetDependencies: []
reportItems: []

Binary file not shown.

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: c6f2a012936476f4b9977de93ff7c358
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 715df9372183c47e389bb6e19fbc3b52, type: 3}
editorImportSettings:
generateSecondaryUVSet: 0
importSettings:
nodeNameMethod: 1
animationMethod: 2
generateMipMaps: 1
texturesReadable: 0
defaultMinFilterMode: 9729
defaultMagFilterMode: 9729
anisotropicFilterLevel: 1
instantiationSettings:
mask: -1
layer: 0
skinUpdateWhenOffscreen: 1
lightIntensityFactor: 1
sceneObjectCreation: 2
assetDependencies: []
reportItems:
- type: 2
code: 20
messages:
- KHR_materials_specular

Binary file not shown.

View File

@@ -0,0 +1,28 @@
fileFormatVersion: 2
guid: 7873ac53dcb4b664fa4a2b98da2bc2cc
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 715df9372183c47e389bb6e19fbc3b52, type: 3}
editorImportSettings:
generateSecondaryUVSet: 0
importSettings:
nodeNameMethod: 1
animationMethod: 2
generateMipMaps: 1
texturesReadable: 0
defaultMinFilterMode: 9729
defaultMagFilterMode: 9729
anisotropicFilterLevel: 1
instantiationSettings:
mask: -1
layer: 0
skinUpdateWhenOffscreen: 1
lightIntensityFactor: 1
sceneObjectCreation: 2
assetDependencies: []
reportItems: []

View File

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

Binary file not shown.

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 669ffaf1d45f3b2488d1e69bb9d2a842
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,359 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 32
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: StylizedWater3_Default cave
m_Shader: {fileID: -6465566751694194690, guid: 823f6b206953b674a9a64f9e3ec57752, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ADVANCED_SHADING
- _CAUSTICS
- _DISTANCE_NORMALS
- _INTERSECTION_FOAM
- _NORMALMAP
- _REFRACTION
- _SURFACE_FOAM_SINGLE
- _TRANSLUCENCY
- _WAVES
m_InvalidKeywords:
- ADVANCED_LIGHTING
- _DEPTHEXP_ON
- _DEPTH_TEX
- _FOAM
- _FOAMON_ON
- _INTERSECTIONSHARP_ON
- _RECEIVEDYNAMICEFFECTSFOAM_ON
- _RECEIVEDYNAMICEFFECTSHEIGHT_ON
- _RECEIVEDYNAMICEFFECTSNORMAL_ON
- _RECEIVEDYNAMICEFFECTS_ON
- _SCREENSPACEREFLECTIONSENABLED_ON
- _SHARP_INERSECTION
- _SIMPLE_LIGHTING
- _SURFACE_FOAM
- _VERTEXCOLORWAVEFLATTENING_ON
- _WORLDSPACEUV_ON
- _ZCLIP_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties: _DepthVertical
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: c94169d55087aee43a4ebd71c975f082, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapLarge:
m_Texture: {fileID: 2800000, guid: efd0d88edbb048d489c41da8174e6a35, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapSlope:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CausticsTex:
m_Texture: {fileID: 2800000, guid: 6a6111d7c04a2aa41a70e3595cc26c9c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DepthTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTex:
m_Texture: {fileID: 2800000, guid: 743c4d2b8fe20124f9260175ab718f33, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTexDynamic:
m_Texture: {fileID: 2800000, guid: 743c4d2b8fe20124f9260175ab718f33, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IntersectionNoise:
m_Texture: {fileID: 2800000, guid: b6d3e8158e6f65a4594526663ad7a894, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normals:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflection:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflectionLeft:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Shadermap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _WaveProfile:
m_Texture: {fileID: 5393152077581806659, guid: 1ca4610f5bf9e2f4bb39535503a79eeb, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- Vector1_1942CF3A: 1
- Vector1_BE75C478: 32
- Vector1_E23F9E57: 0.5
- Vector1_E796673B: 10
- _ADVANCED_LIGHTING: 1
- _AdvancedLighting: 1
- _Advanced_Lighting: 1
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AnimationSpeed: 1
- _Blend: 0
- _BumpScale: 1
- _CROSSPAN_INTERSECTIONOn: 1
- _CausticsBrightness: 2
- _CausticsChromance: 1
- _CausticsDistortion: 0.047
- _CausticsOn: 1
- _CausticsSpeed: 0.1
- _CausticsTiling: 0.1
- _ColorAbsorption: 0
- _CrossPan_IntersectionOn: 0
- _Cull: 0
- _Cutoff: 0.5
- _Depth: 0.94
- _DepthExp: 1
- _DepthHorizontal: 0.01
- _DepthMode: 0
- _DepthTexture: 1
- _DepthVertical: 9.25
- _DisableDepthTexture: 0
- _DistanceFoamTiling: 0.2
- _DistanceNormalsOn: 1
- _DistanceNormalsTiling: 0.05
- _DstBlend: 0
- _EdgeFade: 8
- _EnableDirectionalCaustics: 0
- _EnvironmentReflections: 1
- _EnvironmentReflectionsOn: 1
- _FlatShadingOn: 0
- _FlowSpeed: 1
- _FoamBaseAmount: 0.297
- _FoamBubblesSpread: 1
- _FoamBubblesStrength: 0
- _FoamClipping: 0
- _FoamClippingDynamic: 0
- _FoamDistanceOn: 0
- _FoamDistortion: 0
- _FoamOn: 1
- _FoamOpacity: 0
- _FoamSize: 0.606
- _FoamSpeed: 0.06000001
- _FoamSpeedDynamic: 0.1
- _FoamStrength: 1
- _FoamSubSpeed: -0.25
- _FoamSubSpeedDynamic: -0.1
- _FoamSubTiling: 0.5
- _FoamSubTilingDynamic: 2
- _FoamTiling: 0.09999993
- _FoamTilingDynamic: 0.1
- _FoamWaveAmount: 0
- _FoamWaveMask: 0
- _FoamWaveMaskExp: 1
- _FogSource: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HorizonDistance: 8
- _IntersectionClipping: 0.706
- _IntersectionDistortion: 0
- _IntersectionFalloff: 1
- _IntersectionFoamOn: 1
- _IntersectionLength: 3
- _IntersectionRippleDist: 32
- _IntersectionRippleSpeed: 3
- _IntersectionRippleStrength: 0.5
- _IntersectionSharp: 1
- _IntersectionSize: 0.944
- _IntersectionSource: 0
- _IntersectionSpeed: 0.1
- _IntersectionStyle: 1
- _IntersectionTiling: 0.059999757
- _IntersectionWaveDist: 33.28
- _LightingMode: 2
- _LightingOn: 1
- _Metallic: 0
- _Metallicness: 0.1
- _NORMALMAPOn: 1
- _NormalMap: 1
- _NormalMapOn: 1
- _NormalSpeed: 1
- _NormalStrength: 0.202
- _NormalSubSpeed: -0.8
- _NormalSubTiling: 0.49
- _NormalTiling: -0.48000008
- _OcclusionStrength: 1
- _PlanarReflectionsEnabled: 0
- _PlanarReflectionsParams: 0
- _PointSpotLightReflectionDistortion: 0.5
- _PointSpotLightReflectionExp: 64
- _PointSpotLightReflectionSharp: 0
- _PointSpotLightReflectionSize: 0
- _PointSpotLightReflectionStrength: 10
- _QueueOffset: 0
- _ReceiveDynamicEffectsFoam: 1
- _ReceiveDynamicEffectsHeight: 1
- _ReceiveDynamicEffectsNormal: 1
- _ReceiveShadows: 1
- _ReflectionBlur: 0
- _ReflectionDistortion: 0.146
- _ReflectionFresnel: 6
- _ReflectionLighting: 1
- _ReflectionStrength: 1
- _Reflectivity: 1
- _RefractionAmount: 0.05
- _RefractionChromaticAberration: 1
- _RefractionOn: 1
- _RefractionStrength: 0.105
- _RimRize: 1
- _RimTiling: 0.025
- _RiverModeOn: 0
- _SHARP_INERSECTIONOn: 1
- _ScreenSpaceReflectionsEnabled: 1
- _ShadingMode: 1
- _ShadowStrength: 1
- _ShoreLineLength: 0
- _ShoreLineWaveDistance: 23
- _ShoreLineWaveStr: 1
- _SimpleLighting: 1
- _SlopeAngleFalloff: 25
- _SlopeAngleThreshold: 15
- _SlopeFoam: 1
- _SlopeSpeed: 4
- _SlopeStretching: 0.5
- _SlopeThreshold: 0.25
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SparkleIntensity: 0
- _SparkleSize: 0.302
- _SpecularHighlights: 1
- _SpecularReflectionsOn: 1
- _Speed: 1
- _SrcBlend: 1
- _SunReflectionDistortion: 0.762
- _SunReflectionPerturbance: 0.386
- _SunReflectionSharp: 0
- _SunReflectionSize: 0.932
- _SunReflectionStrength: 10
- _Surface: 0
- _TEXTURE_INTERSECTIONOn: 0
- _Texture_IntersectionOn: 1
- _Tiling: 0.5
- _Translucency: 1
- _TranslucencyCurvatureMask: 0
- _TranslucencyExp: 6
- _TranslucencyOn: 1
- _TranslucencyReflectionMask: 0
- _TranslucencyStrength: 1
- _TranslucencyStrengthDirect: 0.05
- _UnderwaterReflectionStrength: 0.5
- _UnderwaterRefractionOffset: 0.2
- _UnderwaterSurfaceSmoothness: 0.8
- _VertexColorFoam: 0
- _VertexColorTransparency: 0
- _VertexColorWaveFlattening: 1
- _WaveDistance: 0.775
- _WaveDistortion: 0.5
- _WaveFrequency: 0.8
- _WaveHeight: 0.1
- _WaveMaxLayers: 64
- _WaveNormalStr: 0.1
- _WaveSpeed: 2.3999996
- _WaveSteepness: 0
- _WaveTint: 0
- _WavesOn: 1
- _WorkflowMode: 1
- _WorldSpaceUV: 1
- _ZClip: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0, g: 0.16451614, b: 0.34, a: 0.9647059}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _DepthMapBounds: {r: -402.3, g: -459.43, b: 0.0012693577, a: 0}
- _Direction: {r: 1, g: 1, b: 0, a: 0}
- _DistanceFoamFadeDist: {r: 100, g: 350, b: 0, a: 0}
- _DistanceNormalsFadeDist: {r: 69.23079, g: 276.9231, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 1, b: 1, a: 0.92941177}
- _FoamCrestMinMaxHeight: {r: 1, g: 2, b: 0, a: 0}
- _FoamTiling: {r: 0.1, g: 0.1, b: 0, a: 0}
- _HorizonColor: {r: 0.68, g: 1, b: 0.99, a: 0.15}
- _IntersectionColor: {r: 1, g: 1, b: 1, a: 1}
- _NormalTiling: {r: 0.3, g: 0.3, b: 0, a: 0}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _ShallowColor: {r: 0, g: 1, b: 0.98136926, a: 0.3764706}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
- _WaterColor: {r: 0.21176466, g: 0.6745098, b: 1, a: 1}
- _WaterShallowColor: {r: 0, g: 0.9394503, b: 1, a: 1}
- _WaveDirection: {r: -1, g: -1, b: -1, a: -1}
- _WaveFadeDistance: {r: 26.666674, g: 143.33331, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &6498140463000427223
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 71bc95c37439bb64f9ebcd9b3db1b6e6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,314 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 32
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: StylizedWater3_Lowpoly_Cave
m_Shader: {fileID: -6465566751694194690, guid: 823f6b206953b674a9a64f9e3ec57752, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ADVANCED_SHADING
- _FLAT_SHADING
- _INTERSECTION_FOAM
- _RECEIVE_SHADOWS_OFF
- _RIVER
- _TRANSLUCENCY
- _WAVES
m_InvalidKeywords:
- _CROSSPAN_INTERSECTION
- _DEPTHEXP_ON
- _DEPTH_TEX
- _INTERSECTIONSHARP_ON
- _RECEIVEDYNAMICEFFECTSFOAM_ON
- _RECEIVEDYNAMICEFFECTSHEIGHT_ON
- _RECEIVEDYNAMICEFFECTSNORMAL_ON
- _RECEIVEDYNAMICEFFECTS_ON
- _SHARP_INERSECTION
- _ZCLIP_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: 1a9f5604a68a49c489e90410796483a1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapLarge:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMapSlope:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CausticsTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DepthTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTex:
m_Texture: {fileID: 2800000, guid: 743c4d2b8fe20124f9260175ab718f33, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FoamTexDynamic:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IntersectionNoise:
m_Texture: {fileID: 2800000, guid: b6d3e8158e6f65a4594526663ad7a894, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflection:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PlanarReflectionLeft:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _WaveProfile:
m_Texture: {fileID: 5393152077581806659, guid: 1ca4610f5bf9e2f4bb39535503a79eeb, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AnimationSpeed: 1
- _Blend: 0
- _BumpScale: 1
- _CausticsBrightness: 2
- _CausticsChromance: 1
- _CausticsDistortion: 1
- _CausticsOn: 0
- _CausticsSpeed: 0.1
- _CausticsTiling: 0.5
- _ColorAbsorption: 0
- _CrossPan_IntersectionOn: 1
- _Cull: 2
- _Cutoff: 0.5
- _Depth: 2.45
- _DepthExp: 1
- _DepthHorizontal: 2.44
- _DepthMode: 0
- _DepthTexture: 1
- _DepthVertical: 4.2
- _DisableDepthTexture: 0
- _DistanceFoamTiling: 0.2
- _DistanceNormalsOn: 0
- _DistanceNormalsTiling: 0.25
- _DstBlend: 0
- _EdgeFade: 1.01
- _EnableDirectionalCaustics: 0
- _EnvironmentReflections: 1
- _EnvironmentReflectionsOn: 1
- _FlatShadingOn: 1
- _FoamBaseAmount: 1
- _FoamBubblesSpread: 1
- _FoamBubblesStrength: 1
- _FoamClipping: 0
- _FoamClippingDynamic: 0
- _FoamDistanceOn: 0
- _FoamDistortion: 0.1
- _FoamOn: 0
- _FoamOpacity: 1
- _FoamSize: 0.695
- _FoamSpeed: 0.1
- _FoamSpeedDynamic: 0.1
- _FoamStrength: 1
- _FoamSubSpeed: -0.25
- _FoamSubSpeedDynamic: -0.1
- _FoamSubTiling: 0.5
- _FoamSubTilingDynamic: 2
- _FoamTiling: 0.39999992
- _FoamTilingDynamic: 0.1
- _FoamWaveAmount: 0
- _FoamWaveMask: 1
- _FoamWaveMaskExp: 1
- _FogSource: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HorizonDistance: 8
- _IntersectionClipping: 0.5
- _IntersectionDistortion: 0.2
- _IntersectionFalloff: 1
- _IntersectionFoamOn: 1
- _IntersectionLength: 1.98
- _IntersectionRippleDist: 1
- _IntersectionRippleSpeed: 2
- _IntersectionRippleStrength: 0
- _IntersectionSharp: 1
- _IntersectionSource: 0
- _IntersectionSpeed: 0.1
- _IntersectionStyle: 1
- _IntersectionTiling: 0.09999993
- _LightingOn: 1
- _Metallic: 0
- _NormalMapOn: 0
- _NormalSpeed: 0.2
- _NormalStrength: 0
- _NormalSubSpeed: -0.5
- _NormalSubTiling: 0.5
- _NormalTiling: 1
- _OcclusionStrength: 1
- _PlanarReflectionsEnabled: 0
- _PlanarReflectionsParams: 0
- _PointSpotLightReflectionDistortion: 0.5
- _PointSpotLightReflectionExp: 64
- _PointSpotLightReflectionSharp: 0
- _PointSpotLightReflectionSize: 0
- _PointSpotLightReflectionStrength: 10
- _QueueOffset: 0
- _ReceiveDynamicEffectsFoam: 1
- _ReceiveDynamicEffectsHeight: 1
- _ReceiveDynamicEffectsNormal: 1
- _ReceiveShadows: 0
- _ReflectionBlur: 0
- _ReflectionDistortion: 0
- _ReflectionFresnel: 8
- _ReflectionLighting: 0
- _ReflectionStrength: 0.451
- _RefractionChromaticAberration: 0.097
- _RefractionOn: 0
- _RefractionStrength: 0.091
- _RiverModeOn: 1
- _SHARP_INERSECTIONOn: 1
- _ScreenSpaceReflectionsEnabled: 0
- _ShadingMode: 1
- _ShadowStrength: 1
- _ShoreLineLength: 2
- _ShoreLineWaveDistance: 64
- _ShoreLineWaveStr: 0.008
- _SlopeAngleFalloff: 25
- _SlopeAngleThreshold: 15
- _SlopeFoam: 1
- _SlopeSpeed: 4
- _SlopeStretching: 0.5
- _SlopeThreshold: 0.25
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SparkleIntensity: 0
- _SparkleSize: 0.1
- _SpecularHighlights: 1
- _SpecularReflectionsOn: 1
- _Speed: 1
- _SrcBlend: 1
- _SunReflectionDistortion: 1.647
- _SunReflectionPerturbance: 1
- _SunReflectionSharp: 0
- _SunReflectionSize: 0.975
- _SunReflectionStrength: 1
- _Surface: 0
- _TessMax: 15
- _TessMin: 0
- _TessValue: 16
- _Texture_IntersectionOn: 0
- _Translucency: 1
- _TranslucencyCurvatureMask: 1
- _TranslucencyExp: 1
- _TranslucencyOn: 1
- _TranslucencyReflectionMask: 0
- _TranslucencyStrength: 1
- _TranslucencyStrengthDirect: 0.05
- _UnderwaterReflectionStrength: 0.5
- _UnderwaterRefractionOffset: 0.2
- _UnderwaterSurfaceSmoothness: 0.8
- _VertexColorFoam: 0
- _VertexColorTransparency: 0
- _VertexColorWaveFlattening: 0
- _WaveDistance: 0.574
- _WaveFrequency: 0.2
- _WaveHeight: 0.31
- _WaveMaxLayers: 20
- _WaveNormalStr: 0
- _WaveSpeed: 0.5
- _WaveSteepness: 5
- _WaveTint: 0
- _WavesOn: 1
- _WorkflowMode: 1
- _WorldSpaceUV: 1
- _ZClip: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0, g: 0.17100494, b: 0.4811321, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DepthMapBounds: {r: 0, g: 0, b: 0, a: 0}
- _Direction: {r: 1, g: 1, b: 0, a: 0}
- _DistanceFoamFadeDist: {r: 100, g: 350, b: 0, a: 0}
- _DistanceNormalsFadeDist: {r: 300, g: 0.25, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 1, b: 1, a: 1}
- _FoamCrestMinMaxHeight: {r: 1, g: 2, b: 0, a: 0}
- _FoamTiling: {r: 0.1, g: 0.1, b: 0, a: 0}
- _HorizonColor: {r: 0.41037738, g: 0.71931076, b: 1, a: 0}
- _IntersectionColor: {r: 1, g: 1, b: 1, a: 1}
- _NormalTiling: {r: 0.040000014, g: 0.040000014, b: 0, a: 0}
- _ShallowColor: {r: 0, g: 2, b: 1.9607843, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _WaveDirection: {r: 1, g: 1, b: 1, a: 1}
- _WaveFadeDistance: {r: 150, g: 300, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &1092640962685890020
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 2

View File

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

View File

@@ -1,4 +1,4 @@
// Author MikeNspired.
// Author MikeNspired.
using System.Linq;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit.Interactables;
@@ -41,8 +41,25 @@ protected virtual void Awake()
{
CreateTransforms();
}
HidePreviewHandsInPlayMode();
}
private void HidePreviewHandsInPlayMode()
{
if (!Application.isPlaying)
return;
foreach (HandAnimator hand in GetComponentsInChildren<HandAnimator>(true))
{
if (hand != null)
hand.gameObject.SetActive(false);
}
currentLeftHand = null;
currentRightHand = null;
}
//Determine which hand is being grabbed to send the hand animator the proper poses for the hand.
protected virtual void BeginNewHandPoses(HandAnimator hand)
{

View File

@@ -72,9 +72,15 @@ private void OnGrab(SelectEnterEventArgs args)
private void FindHandPoser(SelectEnterEventArgs args)
{
Transform interactableTransform = args.interactableObject.transform;
currentHandPoser =
args.interactableObject.transform.GetComponent<XRHandPoser>() ??
args.interactableObject.transform.GetComponentInChildren<XRHandPoser>();
interactableTransform.GetComponent<XRHandPoser>() ??
interactableTransform.GetComponentInChildren<XRHandPoser>(true) ??
interactableTransform.GetComponentInParent<XRHandPoser>();
if (!currentHandPoser && interactableTransform.parent)
currentHandPoser = interactableTransform.parent.GetComponentInChildren<XRHandPoser>(true);
}
public void ResetAttachTransform()

View File

@@ -23,7 +23,8 @@ protected override void Awake()
{
base.Awake();
OnValidate();
SubscribeToSelection();
if (interactable)
SubscribeToSelection();
}
private void SubscribeToSelection()
@@ -91,12 +92,26 @@ private float GetEaseInTime()
return time;
}
private XRBaseInteractable FindInteractableInAncestorChildren()
{
for (Transform parent = transform.parent; parent != null; parent = parent.parent)
{
XRBaseInteractable foundInteractable = parent.GetComponentInChildren<XRBaseInteractable>(true);
if (foundInteractable != null)
return foundInteractable;
}
return null;
}
private void OnValidate()
{
if (!interactable)
interactable = GetComponent<XRBaseInteractable>();
if (!interactable)
interactable = GetComponentInParent<XRBaseInteractable>();
if (!interactable)
interactable = FindInteractableInAncestorChildren();
if (!interactable)
Debug.LogWarning(gameObject + " XRGrabPoser does not have an XRGrabInteractable assigned." + " (Parent name) " + transform.parent);
}