Browse Source

add treadmill uv shader

main
Cailean Finn 6 months ago
parent
commit
d16faf238b
  1. 7
      Assets/15_Prefabs/Environment.prefab
  2. 8
      Assets/3_Materials/Shaders.meta
  3. 127
      Assets/3_Materials/Shaders/Shader Graphs_Treadmill Belt.mat
  4. 8
      Assets/3_Materials/Shaders/Shader Graphs_Treadmill Belt.mat.meta
  5. 2075
      Assets/3_Materials/Shaders/Treadmill Belt.shadergraph
  6. 10
      Assets/3_Materials/Shaders/Treadmill Belt.shadergraph.meta
  7. 64
      Assets/6_Scenes/Beep.unity
  8. 22
      Assets/7_Scripts/Interactable Items/Treadmill.cs
  9. 2
      Assets/ML-Agents/Timers/Beep_timers.json

7
Assets/15_Prefabs/Environment.prefab

@ -308,6 +308,7 @@ MonoBehaviour:
m_RampTimer: 25
m_RampIncrement: 10
m_HoldSpeedTimer: 0
m_Belt: {fileID: 0}
--- !u!65 &5329883020623688251
BoxCollider:
m_ObjectHideFlags: 0
@ -15957,6 +15958,11 @@ PrefabInstance:
propertyPath: m_Name
value: BB_SpotMini-House_2023-treadmill
objectReference: {fileID: 0}
- target: {fileID: 4929691380514558633, guid: a2aad9ceeb149fb459fb6000a9f79fd5,
type: 3}
propertyPath: 'm_Materials.Array.data[0]'
value:
objectReference: {fileID: 2100000, guid: 55b792bf77a4a3c4bb1167f55a43b49f, type: 2}
- target: {fileID: 244729283271664975, guid: 4a514862db9328d4895ba96423f9bb05,
type: 3}
propertyPath: m_Size.y
@ -16154,6 +16160,7 @@ MonoBehaviour:
m_RampTimer: 0
m_RampIncrement: 30
m_HoldSpeedTimer: 60
m_Belt: {fileID: 2100000, guid: 55b792bf77a4a3c4bb1167f55a43b49f, type: 2}
--- !u!1001 &8700028673438209428
PrefabInstance:
m_ObjectHideFlags: 0

8
Assets/3_Materials/Shaders.meta

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

127
Assets/3_Materials/Shaders/Shader Graphs_Treadmill Belt.mat

@ -0,0 +1,127 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6627252997188956954
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 13
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Shader Graphs_Treadmill Belt
m_Shader: {fileID: -6465566751694194690, guid: b1c80e232b9854741a5a008e04731bd8,
type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _DISABLE_SSR_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2225
stringTagMap:
MotionVector: User
disabledShaderPasses:
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Main:
m_Texture: {fileID: 2800000, guid: 1b5b0716863e35d4c870a5a2f6925343, type: 3}
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:
- _AddPrecomputedVelocity: 0
- _AlphaCutoffEnable: 0
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _BlendMode: 0
- _ConservativeDepthOffsetEnable: 0
- _CullMode: 2
- _CullModeForward: 2
- _DepthOffsetEnable: 0
- _DoubleSidedEnable: 0
- _DoubleSidedGIMode: 0
- _DoubleSidedNormalMode: 2
- _DstBlend: 0
- _DstBlend2: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _ExcludeFromTUAndAA: 0
- _MaterialID: 1
- _MaterialTypeMask: 2
- _OpaqueCullMode: 2
- _PerPixelSorting: 0
- _RayTracing: 0
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _RenderQueueType: 1
- _RequireSplitLighting: 0
- _Speed: -4.4523954
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 9
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 15
- _StencilWriteMaskMV: 41
- _SupportDecals: 1
- _SurfaceType: 0
- _TransmissionEnable: 1
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _TransparentZWrite: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _Direction: {r: 1, g: 1, b: 0, a: 0}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

8
Assets/3_Materials/Shaders/Shader Graphs_Treadmill Belt.mat.meta

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

2075
Assets/3_Materials/Shaders/Treadmill Belt.shadergraph

File diff suppressed because it is too large

10
Assets/3_Materials/Shaders/Treadmill Belt.shadergraph.meta

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b1c80e232b9854741a5a008e04731bd8
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

64
Assets/6_Scenes/Beep.unity

@ -671,7 +671,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 83569712}
serializedVersion: 2
m_LocalRotation: {x: 0.045081474, y: -0.8875922, z: 0.42261943, w: -0.17759675}
m_LocalRotation: {x: 0.03526246, y: -0.893182, z: 0.42510572, w: -0.14236501}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -1245,7 +1245,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 155411616}
serializedVersion: 2
m_LocalRotation: {x: 0.03171485, y: -0.85361236, z: 0.48761967, w: -0.18046357}
m_LocalRotation: {x: 0.024549965, y: -0.8590012, z: 0.49051577, w: -0.14459783}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -2828,7 +2828,7 @@ MonoBehaviour:
LensShift: {x: 0, y: 0}
GateFit: 1
FocusDistance: 8.93528
m_SensorSize: {x: 70.41, y: 52.63}
m_SensorSize: {x: 1, y: 1}
Iso: 50
ShutterSpeed: 0.0005
Aperture: 2.2
@ -3029,7 +3029,7 @@ MonoBehaviour:
LensShift: {x: 0, y: 0}
GateFit: 1
FocusDistance: 0.01
m_SensorSize: {x: 70.41, y: 52.63}
m_SensorSize: {x: 1, y: 1}
Iso: 50
ShutterSpeed: 0.0005
Aperture: 1.9
@ -3222,17 +3222,17 @@ PrefabInstance:
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
propertyPath: m_LocalPosition.x
value: -245.54
value: -271.94
objectReference: {fileID: 0}
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
propertyPath: m_LocalPosition.y
value: 5.9799995
value: 7.74
objectReference: {fileID: 0}
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
propertyPath: m_LocalPosition.z
value: 480.57
value: 560.77
objectReference: {fileID: 0}
- target: {fileID: 3364236482078802793, guid: 263d8cea838224448bdfd0e71bc2dce4,
type: 3}
@ -4215,7 +4215,7 @@ Camera:
m_Iso: 50
m_ShutterSpeed: 0.002
m_Aperture: 3.6
m_FocusDistance: 6.3245435
m_FocusDistance: 6.324545
m_FocalLength: 35.000004
m_BladeCount: 5
m_Curvature: {x: 26.748837, y: 32}
@ -4257,8 +4257,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 470663197}
serializedVersion: 2
m_LocalRotation: {x: 0.086117, y: -0.02407322, z: 0.0020814561, w: 0.995992}
m_LocalPosition: {x: 9.919113, y: -4.307354, z: -2.8405762}
m_LocalRotation: {x: 0.086134925, y: 0.012870895, z: -0.0011128626, w: 0.9961997}
m_LocalPosition: {x: 9.930588, y: -4.307354, z: -3.1634521}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -4451,7 +4451,7 @@ MonoBehaviour:
LensShift: {x: 0, y: 0}
GateFit: 1
FocusDistance: 8.93528
m_SensorSize: {x: 70.41, y: 52.63}
m_SensorSize: {x: 1, y: 1}
Iso: 50
ShutterSpeed: 0.0005
Aperture: 2.2
@ -4644,8 +4644,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 513050371}
serializedVersion: 2
m_LocalRotation: {x: 0.11451177, y: -0.021367181, z: 0.0024635731, w: 0.99318904}
m_LocalPosition: {x: 10.035126, y: -3.2973547, z: -5.35791}
m_LocalRotation: {x: 0.17489053, y: -0.25582165, z: 0.047115173, w: 0.9496046}
m_LocalPosition: {x: 10.033722, y: -3.2973547, z: -5.6853027}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -5280,8 +5280,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 562470283}
serializedVersion: 2
m_LocalRotation: {x: 0.42771065, y: -0.5667285, z: 0.44248822, w: 0.54780173}
m_LocalPosition: {x: 19.623474, y: 33.692642, z: 3.4919434}
m_LocalRotation: {x: 0.121948026, y: 0.7725755, z: -0.603209, w: 0.15618807}
m_LocalPosition: {x: 6.201065, y: 33.692642, z: 12.049194}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -9913,7 +9913,7 @@ Transform:
m_GameObject: {fileID: 1124157896}
serializedVersion: 2
m_LocalRotation: {x: -0.051868558, y: 0.9246109, z: -0.34594372, w: -0.1507558}
m_LocalPosition: {x: 9.919113, y: -4.307354, z: -2.8405762}
m_LocalPosition: {x: 9.930588, y: -4.307354, z: -3.1634521}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -10336,7 +10336,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1178814724}
serializedVersion: 2
m_LocalRotation: {x: 0.03171485, y: -0.85361236, z: 0.48761967, w: -0.18046357}
m_LocalRotation: {x: 0.024549956, y: -0.8590012, z: 0.49051577, w: -0.1445978}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -11475,7 +11475,7 @@ PrefabInstance:
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.x
value: -214.2458
value: -265.68393
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
@ -11485,12 +11485,12 @@ PrefabInstance:
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalPosition.z
value: 525.6574
value: 547.2145
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.94074494
value: 0.25410977
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
@ -11500,7 +11500,7 @@ PrefabInstance:
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.33911493
value: -0.9671754
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
@ -11515,7 +11515,7 @@ PrefabInstance:
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -39.646
value: -150.558
objectReference: {fileID: 0}
- target: {fileID: 2722580235232797026, guid: f03606b436da1d94e977c8ffa2825bd9,
type: 3}
@ -16675,6 +16675,16 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1170441306195283109, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_LocalPosition.x
value: -39.04
objectReference: {fileID: 0}
- target: {fileID: 1170441306195283109, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_LocalPosition.z
value: 137.31
objectReference: {fileID: 0}
- target: {fileID: 1433528410791844214, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_Index
@ -16825,6 +16835,16 @@ PrefabInstance:
propertyPath: m_Index
value: 8
objectReference: {fileID: 0}
- target: {fileID: 7419875685076643595, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_LocalPosition.x
value: -37.43
objectReference: {fileID: 0}
- target: {fileID: 7419875685076643595, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_LocalPosition.z
value: 133.36
objectReference: {fileID: 0}
- target: {fileID: 7773461343564336651, guid: 796c0c7bfd2e89547bd866eedcc6d386,
type: 3}
propertyPath: m_WaitTime

22
Assets/7_Scripts/Interactable Items/Treadmill.cs

@ -21,6 +21,10 @@ public class Treadmill : MonoBehaviour
public float m_HoldSpeedTimer;
public Material m_Belt;
private float m_BeltSpeed;
private void OnEnable()
{
OnChairContact.ApplyTreadmillForce += ApplyForce;
@ -61,6 +65,10 @@ public class Treadmill : MonoBehaviour
}
rb.AddForce(forceDirection * m_CurrentForce);
}
}
@ -76,4 +84,18 @@ public class Treadmill : MonoBehaviour
Gizmos.color = Color.red;
Gizmos.DrawRay(transform.position, Quaternion.Euler(0, -m_angleOffset, 0) * Vector3.forward);
}
private void FixedUpdate()
{
m_BeltSpeed += Map(m_CurrentForce, 0, 600, 0, 0.01f);
m_Belt.SetFloat("_Speed", -m_BeltSpeed);
Debug.Log($"{m_BeltSpeed} {m_CurrentForce}");
}
private float Map(float s, float a1, float a2, float b1, float b2)
{
return b1 + (s - a1) * (b2 - b1) / (a2 - a1);
}
}

2
Assets/ML-Agents/Timers/Beep_timers.json

@ -1 +1 @@
{"count":1,"self":29.9055488,"total":30.5298308,"children":{"InitializeActuators":{"count":1,"self":0.001006,"total":0.001006,"children":null},"InitializeSensors":{"count":1,"self":0.0020058,"total":0.0020058,"children":null},"AgentSendState":{"count":1189,"self":0.0142451,"total":0.33428379999999996,"children":{"CollectObservations":{"count":238,"self":0.0071046999999999994,"total":0.0071046999999999994,"children":null},"WriteActionMask":{"count":238,"self":0,"total":0,"children":null},"RequestDecision":{"count":238,"self":0.312934,"total":0.312934,"children":null}}},"DecideAction":{"count":1189,"self":0.26906769999999997,"total":0.2726116,"children":{"RayPerceptionSensor.Perceive":{"count":238,"self":0.0035439,"total":0.0035439,"children":null}}},"AgentAct":{"count":1189,"self":0.0143758,"total":0.0143758,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1712578559","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_03-Beep\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1712578590"}}
{"count":1,"self":26.9375552,"total":27.2160692,"children":{"InitializeActuators":{"count":1,"self":0.0010069,"total":0.0010069,"children":null},"InitializeSensors":{"count":1,"self":0.0030293,"total":0.0030293,"children":null},"AgentSendState":{"count":1022,"self":0.0127094,"total":0.0316756,"children":{"CollectObservations":{"count":205,"self":0.0080762,"total":0.0080762,"children":null},"WriteActionMask":{"count":205,"self":0,"total":0,"children":null},"RequestDecision":{"count":205,"self":0.01089,"total":0.01089,"children":null}}},"DecideAction":{"count":1022,"self":0.2316887,"total":0.23319979999999998,"children":{"RayPerceptionSensor.Perceive":{"count":205,"self":0.0015111,"total":0.0015111,"children":null}}},"AgentAct":{"count":1022,"self":0.0086032,"total":0.0086032,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1712580257","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_03-Beep\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1712580284"}}
Loading…
Cancel
Save