Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can Curve Spline be used for an in game level editor.
#21
(05-08-2023, 05:58 AM)Lupos Wrote: I just discovered I get this error if I delete a generator that is inactive. (Rather this seems to happen if I Just end the game and it tries to auto delete/cleanup)
I tried to reproduce the issue but couldn't. Could you please send me a reproduction case?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#22
(05-05-2023, 12:45 PM)Lupos Wrote:
(05-05-2023, 10:22 AM)_Aka_ Wrote: You can find them by searching for files with the asmdef extensions.
I tried and no files for Curvy seem to exist. I was able to find everything but curvy's asmdef.

Edit* I found the generate asmdef button in the Curvy options menu (after reading the changelog.) I'm wondering if this is an issue since without these files generated, its not possilbe to make the modifications you mentioned. 

You suggested either delete these files, or modify them to support the files I needed. Well it appears not having them just doesn't work and I'm forced to generate them and append my required data into it.

Edit** Another issue I came across was that I can't both reference the CurvySpline asdmf in my own code, and have it reference my code. (circular dependency.) I wish there was a simply way to override the parameters I need within my own code, or possibly inject what I need.


Edit*** Because I had the asset in the plugin folder, I was prevented from accessing my own namespaces without the asmdfs. (I forget if I added it to plugins myself or not)


The asset is automatically installed in the Plugins folder. My bad, I should have told to make sure the asset is outside that special folder. I will not explain the entire Unity logic of code dependencies (I invite you to look for that, it is interesting to learn), but the Plugins folder is a special that has no access to the remaining code in Assets. This is true for Asmdefs too, except if you add to them dependencies. The best place for code to have access to all code is outside any special folder, and with no asmdefs.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#23
(05-05-2023, 12:45 PM)Lupos Wrote: I've created a simple package with just 1 scene, 1 prefab. No scripts or anything. I didn't include Curvy either to avoid breaking the law.

You can see here that I have the generator added to the spline, rather then the spline added to the generator (like the default behavior when creating a generator and a spline input)
This is so I could share 1 spline across many generators.

I was able to reproduce the issue. Working on it.

(05-05-2023, 12:45 PM)Lupos Wrote:
Side request, is it possible to zoom in the Generator graph? And if not, is that functionality possibly able to be added?
Not possible at the time being. It is something that I am intending at adding at some point. I can't give an ETA right now.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#24
(05-08-2023, 10:16 AM)_Aka_ Wrote: I was able to reproduce the issue. Working on it.

Fixed it. Replace the code of SplineInputModuleBase.ValidateStartAndEndCps with the following:

Code:
        protected void ValidateStartAndEndCps()
        {
            if (InputSpline == null)
                return;
            if (InputSpline.IsInitialized == false)
                return;

            if (m_StartCP && m_StartCP.Spline != InputSpline)
            {
                DTLog.LogError(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "[Curvy] Input module {0}: StartCP is not part of the input spline ({1})",
                        name,
                        InputSpline.name
                    ),
                    this
                );
                m_StartCP = null;
            }

            if (m_EndCP && m_EndCP.Spline != InputSpline)
            {
                DTLog.LogError(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "[Curvy] Input module {0}: EndCP is not part of the input spline ({1})",
                        name,
                        InputSpline.name
                    ),
                    this
                );
                m_EndCP = null;
            }

            if (m_EndCP != null
                && m_StartCP != null
                && InputSpline.GetControlPointIndex(m_EndCP) <= InputSpline.GetControlPointIndex(m_StartCP))
            {
                DTLog.LogError(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "[Curvy] Input module {0}: EndCP has an index ({1}) less or equal than StartCP ({2})",
                        name,
                        InputSpline.GetControlPointIndex(m_EndCP),
                        InputSpline.GetControlPointIndex(m_StartCP)
                    ),
                    this
                );
                m_EndCP = null;
            }
        }

Sorry for the inconvenience due to this bug. The fix will be available in the next update.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#25
(04-28-2023, 06:45 AM)danne_lindwall Wrote: How would I get per segment data so I can modify the refresh. Specifically the endDistance/startDistance stuff

Every CurvySplineSegment has a Distance property. Assuming your path is the full spline, then
yourSegmentStartDistance = yourSegment.Distance / yourSpline.Length
Depending on when you execute the code (in Awake for example), make sure that yourSpline.IsInitialized is true and that yourSpline.Dirty is false.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#26
(05-05-2023, 10:25 PM)Lupos Wrote: I've made an attempt to make my own generator. Likely due to my novice experience with this asset and its api, but I did end up needing to do a considerable amount of copying from existing modules and editors.

I was sorta able to make it work by doing the following

1) customize Spline Input to generate an array of segments (instead of an entire spline)
2) customize Spline Rasterizer to take the multiple inputs and rasterize them into the usable data
3) customize Volume Spots to take the multiple segments and generate data, then apply a custom unit offset (based off the original range param) to offset.

It sorta seems to be working however I'm having trouble getting closed to work, its likely due to how I've tried implementing this. I also still get the error in relation to StartCP/EndCP as I told you before.

If possible, would you mind taking a look? I'd love a fix to why I can't seem to make it close. It's related to try to send the end/start points as a segment (and the distance ending up calculating negative.

But I'm also just curious if this is even the best way, is there an easier way to do this without needing all these modules? Maybe a way to just modify the volume spots module to only generate within a segment (without feeding it custom new segments?)

I'm pretty stumped haha, but I'm happy I was able to get as far as I did. Learned a lot in the process.

Good job Lupos Smile
I attached a modified version of your scene where things are working (assuming you apply the fix I posted above on your code)
To be completely honest, I don't have time right now to dive into your code and give advise. You should know in a couple of days what is keeping me so busy these days. I will try to check your code ASAP. But until then I did a simple work around in the scene I attached, that does not need looking into your code:
If your code works well on open splines, but not on closed ones, then why not just use open splines ;D I modified your scene so that the spline is open, but set it up so that it looks exactly as a closed spline. I did that by adding a last cp at the same position as the first one, and applying the Bezier handles of the closed spline CPs into the open spline CPs.

I hope today's posts helped you.
Have a great day.


Attached Files
.unity   Scene2.unity (Size: 43.81 KB / Downloads: 0)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#27
(05-08-2023, 09:45 AM)_Aka_ Wrote: I tried to reproduce the issue but couldn't. Could you please send me a reproduction case?

I've tried to make an example but its not really something easily identifiable. It's related to the undo, and seems to happen if I try to undo/redo in play (or at least press keys related.)

Sadly its not super consistent. Ill keep looking.


(05-08-2023, 09:45 AM)_Aka_ Wrote:
I will try to check your code ASAP.


Okay sweet, honestly it's not perfectly what I'm after either so I'm trying to think on what to do. The amount of work I had to do to get it working is a little demoralizing and I'm afraid about how long it'd take to get what I actually want. 

Ideally I'm trying to make a custom generator spawn the meshes starting from the center point, outwards. So if short but long enough, it'll spawn 1 item between both splines. If longer, it'll spawn one on each side of the center spline. This way I can make sure the distance on each start/end point can be exactly the same to account for towers.
Reply
#28
(05-09-2023, 05:06 AM)Lupos Wrote:
(05-08-2023, 09:45 AM)_Aka_ Wrote: I tried to reproduce the issue but couldn't. Could you please send me a reproduction case?

I've tried to make an example but its not really something easily identifiable. It's related to the undo, and seems to happen if I try to undo/redo in play (or at least press keys related.)

Sadly its not super consistent. Ill keep looking.


(05-08-2023, 09:45 AM)_Aka_ Wrote:
I will try to check your code ASAP.


Okay sweet, honestly it's not perfectly what I'm after either so I'm trying to think on what to do. The amount of work I had to do to get it working is a little demoralizing and I'm afraid about how long it'd take to get what I actually want. 
Ideally I'm trying to make a custom generator spawn the meshes starting from the center point, outwards. So if short but long enough, it'll spawn 1 item between both splines. If longer, it'll spawn one on each side of the center spline. This way I can make sure the distance on each start/end point can be exactly the same to account for towers.
Edit*
[/quote]


(05-08-2023, 09:45 AM)_Aka_ Wrote: .
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.


I've done just that, sorry for the delay. Wanted to make sure I could at least get somewhat close to what I needed first. Thank you so much btw.
Reply
#29
Noted for the undoing issue, thanks. You saying that it happened in play mode was useful to me.
Thanks a lot for the review, appreciated.
About how to populate a segment from center going to the outside, I am sure there are generic, non Curvy Splines specific, solutions already available on the internet. If you can't find them, ask ChatGPT about it, the problem is common and simple enough that I bet he can suggest something good (or at least a good start for you). Then just modify that code to plug in the correct values from Curvy Splines API
I hope this helped
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#30
(05-09-2023, 09:24 AM)_Aka_ Wrote:  ask ChatGPT about it, the problem is common and simple enough that I bet he can suggest something good (or at least a good start for you). Then just modify that code to plug in the correct values from Curvy Splines API
I hope this helped

Haha, I did end up trying this. Took much longer then I wanted to get working. ChatGPT was sorta able to help me get a vague idea of where to go eventually. But it was def a struggle.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to get length starting from one spline to connected nth spline Dragon-3623 1 1 05-14-2024, 04:52 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_

Forum Jump: