Crest Ocean System integration

Has anyone used the swimming pack with Crest ocean system? I'm trying but i see crest has no colliders, its a shader. How would you implement swimming with crest ocean system?
 
Has anyone used the swimming pack with Crest ocean system? I'm trying but i see crest has no colliders, its a shader. How would you implement swimming with crest ocean system?
I haven't used Crest before. Does it allow you to assign a layer to the shader?

If so, I guess it would be based on the size and type of water you want to implement. However, regardless of this question you HAVE to use a box collider atm because UCC Swim Addon does not support direct ray cast trigger detection unless there is a box collider to get the layer/trigger from. I'm working on modifying their entire system to support mesh colliders and/or a direct ray cast to the layer rather than rely on a box collider. Box colliders are okay if your just using a simple "box" style water object, but ponds, lakes, etc are never square or rectangle, so it leaves room for error on the trigger detection and ability start/stop due to the collider being outside the actual water layer (I've seen this actually take place on a scene I'm working on where I had to place a Box Collider (re-sized to optimal sizes) for a lake I have where I want the player to swim in, mostly underwater. Beware, The swimming add-on is full of glitches and bugs and you'll have to modify it a lot to get the results you want. Dissappointing actually. But oh well. Such is life.
 
However, i've seen a Underwater controller for crest. Makes me wonder, how is it implemented and is it possible to integrate the swimming pack with crest. I'll keep looking for answers and come back.
 
I just spent all weekend learning how Crest works and how Ultimate Character Controller works. I just figured out how to get my UCC character to enter and exit Crest Water System and I'm sampling the water height and flow data from Crest to do this, so I will be able to apply pseudo-realistic movements and glide down the waves, etc. It was very hard and confusing since this was my first time making a custom ability for UCC, and I had numerous problems with both crest and UCC to work through. I am still not done. It's going to be awesome though. Even if you could do a collider on crest, that would probably hurt performance because the mesh would be too large. This method I used is the same code from their SimpleFloatingObject.cs script in the demo, but combined with a modified Swim.cs that doesn't require colliders to work because I removed its base class and rewrote some parts. I made this as a new ability called FloatOnCrest.cs in order to be able to keep swim with box colliders intact. It lets me go underwater and swim still as well. Very cool. I'm so excited about the quality of crest / enviro / gaia combined.
 
It is amazing. I got the flow data to work on the character as well now which even works underwater. I will probably add in some code that reduces the flow movement as you go deeper so you have more control further down. In rough seas, you get tossed around so bad that you can't keep your head above water. I adjusted the values a bit to make it more playable in more conditions. 30 foot glass or 10 foot chop or normal. I really like how it is able to pick you up off the ground when you just stand by the shore and a wave comes in. It could take some more effort to make it really smooth on rough conditions. I actually like this though because I wanted someone to fail to try to escape an island by swimming due to the currents being too strong. As you get further from the island where the water is deeper, you can see the effects even more. It is possible to get the character to move 20-30 feet in the water in a few seconds with the right settings just from big waves and no input. I'd probably need to do some adjustments to how the camera works in this mode.

I think there is a way to get stuck in the ExitWaterIdle state If you swim in shallow area and it transitions state back and forth too fast, so maybe i need something to guard one of the transitions to ensure it can resolve that. I just want it to be easy for the player to get back on ground and it has been very annoying how rigidbody keeps locking you in place when these state transitions fail or whatever, even if they are able to walk underwater or something. I don't like that climb from water animation which is designed for a pool, I just want it to be smooth based on terrain collider and regular movement animations. I feel like there should be some kind of "force me back to idle" ability that is always Concurrent, that just tries to give the player a way to keep playing without having to suffer terrain / logic glitches. I've played commercial games where I got stuck and usually some random jumping works.

I don't know what the policy is on sharing code for a project that is a based on a paid asset (swimming pack). Maybe if the folks at Opsive say yes.
My code would be a starting point. I wanted to also try to get Dynamic Water Physics 2 working with this too, but I couldn't figure out how to make a humanoid move in that demo without doing crazy movements. It seems to depend on the rudder and hull being correctly shaped instead of letting anything move in the water. Maybe I will figure that out later too. However, being able to get on a boat and ride on crest with a UCC controller is definitely on my todo list. I was going to do both a row boat, and a boat with an engine.
 
I believe if we ask for it they will do it, it was the same case with the horse animset pro integration. There was a post first, then the integration came. If you get it working and are willing to start the ball rolling i suggest you share the files here and let @Justin have a look at it, crest and gaia are amazing. I buy everything opsive recommends and integrates with :)
 
I sent an email to Justin to see what he thinks about sharing, and to do some commercial support hours since I think I could benefit from that.

I bought everything opsive integrates with including the horse one. I think the mount stuff in the horse one will be good for the boats and sea creature mounts I want to do. I'd probably do some crazy jumping out of water and speed swimming too. They are so good. I've only be doing unity for a month now, but I did like 200 hours. I'm trying to buy everything and work hard to get started faster. The winter sale made me act faster. It took forever to comb the store for everything and I choose to pick out the best of everything which appeared to be Opsive, Gaia Pro, Crest, etc. It seems like while it may be hard to charge a lot of money for indie games, the asset store is too cheap for what you are getting. After seeing how much unity does for you and spending a few thousand on assets to fill in more gaps, there is a huge reduction in cost to getting to a very high level of features and fidelity.

I love just watching the water move my character around without me doing anything - so much struggle of being stuck in the sand! I've been watching enviro and crest all week, and it's just awesome to be able to recreate nature like this. But if I use that broken feature in any of these tools I'm using, I have a very zero progress day.
 
Justin said I could share a diff patch on the forum since I have so much code from the paid swim.cs in it. You and I would I need to run command line stuff to do that which I'd have to figure out. I think this is pretty error prone and I'd rather keep it simple for myself and directly support you via email / screenshare if you are serious.

If you or someone else wants to contact me about this ability, you can find my contact information here:

I'm a web developer just getting started with Unity.

You might want to wait until I get more things working and have smoother movement, though it will be random timing when I do this work. It could also be useful as is if you just need the basics in order to take it in another direction. It might be easier to do through email / screen share if you are super motivated to get this working. At the moment, it is kind of standalone but I'm starting to mix some features to reuse the crest data efficiently for other things. And you need to have a scene with UCC and crest already setup, which might require some extra steps.
 
Justin said I could share a diff patch on the forum since I have so much code from the paid swim.cs in it. You and I would I need to run command line stuff to do that which I'd have to figure out. I think this is pretty error prone and I'd rather keep it simple for myself and directly support you via email / screenshare if you are serious.

If you or someone else wants to contact me about this ability, you can find my contact information here:

I'm a web developer just getting started with Unity.

You might want to wait until I get more things working and have smoother movement, though it will be random timing when I do this work. It could also be useful as is if you just need the basics in order to take it in another direction. It might be easier to do through email / screen share if you are super motivated to get this working. At the moment, it is kind of standalone but I'm starting to mix some features to reuse the crest data efficiently for other things. And you need to have a scene with UCC and crest already setup, which might require some extra steps.
Amazing! I'll gladly pay for your services to help me get the crest and opsive integration working
 
I just spent all weekend learning how Crest works and how Ultimate Character Controller works. I just figured out how to get my UCC character to enter and exit Crest Water System and I'm sampling the water height and flow data from Crest to do this, so I will be able to apply pseudo-realistic movements and glide down the waves, etc. It was very hard and confusing since this was my first time making a custom ability for UCC, and I had numerous problems with both crest and UCC to work through. I am still not done. It's going to be awesome though. Even if you could do a collider on crest, that would probably hurt performance because the mesh would be too large. This method I used is the same code from their SimpleFloatingObject.cs script in the demo, but combined with a modified Swim.cs that doesn't require colliders to work because I removed its base class and rewrote some parts. I made this as a new ability called FloatOnCrest.cs in order to be able to keep swim with box colliders intact. It lets me go underwater and swim still as well. Very cool. I'm so excited about the quality of crest / enviro / gaia combined.
Will try this and let you know how it goes :) ill record it if it works
 
If you want to contact me with the info on my web site, I'm around. You could save some time and then further customize it.
 
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;

        }
    }
}
 
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;

        }
    }
}
could you please make a quick video showing this implementation? sounds amazing! it'd really help everyone in the community!
 
I didn’t have to really adjust anything other then my box collider as they tell you and set my ocean to water layer and make sure the swim ability only detects that layer, I put my box collider on my ocean inspectior field, and had to play with it during run time to get the correct position , although it may depend on how you setup crest
 
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
 
When I go on break I’ll add a video clip of my player in the water and see if I can find the video that helped me setup my ocean system
 
Back
Top