Crest Ocean System integration

i use the store version, i believe they are they same but with a few differences on performance and graphics, any idea how to implement this? its the only missing piece in my game :p
 
I created a empty game objects and placed all my ocean components in the inspector, and made its layer water , added the box collider and did as stated above
could you please make a video about it? it's been around 1 year and no one bothered to make one
 
I am using the Crest system with the standard swim ability. I set the "Water height detection method" to custom, and created a script that updates the water height every frame (through the SetWaterSurfacePosition() method of the swim ability).
Then I had to adjust the trigger height of the ocean to be on the level of the highest waves. I also had to set the "Surface buoyancy amount" of the swim ability to 0.5. With this if works just fine. Here's my minimal script.

Code:
namespace Ai.Atnc.Abilities
{
    using Opsive.UltimateCharacterController.AddOns.Swimming;
    using Opsive.UltimateCharacterController.Character;
    using UnityEngine;
    using Crest;


    public class SetWaterHeight : MonoBehaviour
    {
        private UltimateCharacterLocomotion characterLocomotion;
        private Swim swimAbility;
        private SampleHeightHelper sampleHeightHelper = new SampleHeightHelper();

        private void Start()
        {
            characterLocomotion = GetComponent<UltimateCharacterLocomotion>();
            swimAbility = characterLocomotion.GetAbility<Swim>();  
        }

        void Update()
        {
            var sampledHeight = SampleWaterHeight();
            swimAbility.SetWaterSurfacePosition(sampledHeight);
        }

        private float SampleWaterHeight()
        {
            var position = characterLocomotion.transform.position;

            sampleHeightHelper.Init(position, 0f, false);

            sampleHeightHelper.Sample(out float height);

            return height;

        }
    }
}

Im trying your implementation but can't figure out the,
"Then I had to adjust the trigger height of the ocean to be on the level of the highest waves"
Could you please help me understand your implementation?
 

nathanj

Active member
You need to put a box collider around the whole area of the water and make sure the Y value is large enough that it conatains all the crest water.

In my scene I have a water collider that covers the whole scene, like this:
WaterCollider.PNG

Here are my swim ability settings:
swimAbility.PNG

And then add that script to your player and that should be it.
 
Top