From 511b005887d7c2e886b6847d07bd50417755ee1d Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Sun, 12 Mar 2023 17:45:08 +0100 Subject: [PATCH] lock rotation i think --- Assets/sunset_box/GameObject.prefab | 32 +++++++++++++++++++++ Assets/sunset_box/GameObject.prefab.meta | 7 +++++ Assets/sunset_box/sunset_box.unity | 23 ++++++++++++++- Assets/sunset_box/sunset_env_dynamic.shader | 4 +++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 Assets/sunset_box/GameObject.prefab create mode 100644 Assets/sunset_box/GameObject.prefab.meta diff --git a/Assets/sunset_box/GameObject.prefab b/Assets/sunset_box/GameObject.prefab new file mode 100644 index 0000000..bbfb695 --- /dev/null +++ b/Assets/sunset_box/GameObject.prefab @@ -0,0 +1,32 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8496610095942690802 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 346340643590905982} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &346340643590905982 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8496610095942690802} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.92657536, y: -0.24109477, z: 3.413753} + 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} diff --git a/Assets/sunset_box/GameObject.prefab.meta b/Assets/sunset_box/GameObject.prefab.meta new file mode 100644 index 0000000..b9f9ca6 --- /dev/null +++ b/Assets/sunset_box/GameObject.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b1075e33d7dbe17c9b7e6ff36e01c2e2 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/sunset_box/sunset_box.unity b/Assets/sunset_box/sunset_box.unity index 64da21e..9cc4a04 100644 --- a/Assets/sunset_box/sunset_box.unity +++ b/Assets/sunset_box/sunset_box.unity @@ -134,6 +134,7 @@ GameObject: - component: {fileID: 733733047} - component: {fileID: 733733046} - component: {fileID: 733733051} + - component: {fileID: 733733050} m_Layer: 0 m_Name: SunsetBox m_TagString: Untagged @@ -200,7 +201,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 733733045} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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: @@ -209,6 +210,26 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1818360609 &733733050 +RotationConstraint: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 733733045} + m_Enabled: 1 + m_Weight: 1 + m_RotationAtRest: {x: 0, y: 0, z: 0} + m_RotationOffset: {x: 0, y: 0, z: 0} + m_AffectRotationX: 1 + m_AffectRotationY: 0 + m_AffectRotationZ: 1 + m_IsContraintActive: 1 + m_IsLocked: 1 + m_Sources: + - sourceTransform: {fileID: 346340643590905982, guid: b1075e33d7dbe17c9b7e6ff36e01c2e2, + type: 3} + weight: 1 --- !u!135 &733733051 SphereCollider: m_ObjectHideFlags: 0 diff --git a/Assets/sunset_box/sunset_env_dynamic.shader b/Assets/sunset_box/sunset_env_dynamic.shader index e401471..97fd91b 100644 --- a/Assets/sunset_box/sunset_env_dynamic.shader +++ b/Assets/sunset_box/sunset_env_dynamic.shader @@ -222,6 +222,7 @@ float3 origin = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)); float3 sun_dir = (mul(unity_ObjectToWorld, float4(0, 0, -1, 1)) - origin) * float3(1, 0, 1); // sun_dir.y = sin(_Time.x * 10) * 0.05; + sun_dir.y = 0.01; sun_dir = normalize(sun_dir); float3 dir = normalize(i.hit_pos - i.cam_pos); @@ -248,6 +249,9 @@ col = water_col * max(subsurf * 12 - 2, 0.7); + float diffuse = max(dot(sun_dir, water_normal), 0); + col += water_col * _SunCol * diffuse * 10; + // float3 water_ao = get_ao(surface_pos.xz); // col = water_col * lerp(0.1, water_ao, _WaveStrength) * 7;