From f08dcb7c3dd30b6483da661ffc5141b407ed42fe Mon Sep 17 00:00:00 2001 From: in0finite Date: Thu, 3 Mar 2022 05:55:19 +0100 Subject: [PATCH] use separate collision height for shallow water faces --- Assets/Scripts/Behaviours/World/Water.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Behaviours/World/Water.cs b/Assets/Scripts/Behaviours/World/Water.cs index 076e86f4..dcbc8c52 100644 --- a/Assets/Scripts/Behaviours/World/Water.cs +++ b/Assets/Scripts/Behaviours/World/Water.cs @@ -16,7 +16,8 @@ namespace SanAndreasUnity.Behaviours.World [SerializeField] private GameObject m_waterCollisionPrefab; [SerializeField] private bool m_createCollisionObjects = false; - [SerializeField] private float m_collisionHeight = 20f; + [SerializeField] private float m_collisionHeight = 200f; + [SerializeField] private float m_shallowCollisionHeight = 10f; [SerializeField] private bool m_createVisualsForCollisionObjects = false; [HideInInspector] [SerializeField] private List m_renderingObjects = new List(); @@ -151,8 +152,10 @@ namespace SanAndreasUnity.Behaviours.World if (this.IsInterior(center.y)) center.y += Cell.Singleton.interiorHeightOffset; + bool isShallow = (face.Flags & WaterFlags.Shallow) != 0; + Vector3 size = max - min; - size.y = m_collisionHeight; + size.y = isShallow ? m_shallowCollisionHeight : m_collisionHeight; return (center, size); }