coordinates my behated

This commit is contained in:
Crispy 2023-02-12 20:11:26 +01:00
parent 1acea90fc9
commit b6801efcef
2 changed files with 4 additions and 3 deletions

View file

@ -567,7 +567,7 @@ PrefabInstance:
- target: {fileID: -8679921383154817045, guid: 5009e49fafd33ed0e980b53b1f9e954d,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
value: -0.232
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5009e49fafd33ed0e980b53b1f9e954d,
type: 3}

View file

@ -123,10 +123,11 @@
float3 dir = real_dir;
float real_y = asin(dir.y);
if (real_y < 0.0) { // distort to look like water reflection
float3 camera_local_pos = i.cam_pos + mul(unity_WorldToObject, float4(0, 0, 0, 1));
float3 object_pos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
float3 camera_local_pos = i.cam_pos - object_pos;
float3 surface_pos = float3 (
camera_local_pos.x - camera_local_pos.y / (real_dir.y / real_dir.x),
0.0,
0,
camera_local_pos.z - camera_local_pos.y / (real_dir.y / real_dir.z)
);
float3 water_normal = get_water_normal(surface_pos.xz);