Search Unity

[RELEASED] Curvy 2 - the ultimate spline solution

Discussion in 'Assets and Asset Store' started by Jake-L, Sep 29, 2015.

  1. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    I'm not sure what triggers it exactly. After the last reset it didn't happen again (fingers crossed). However now it just keeps spawning more and more objects.
     
  2. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    If you set Space Before and Space After to negative values, it will make the objects tighter and tighter, spawning more objects. Is that what you are describing here? If not, can you give me more information, and hopefully a reproduction case?
     
  3. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    No, that's not the problem. The problem is that old copies aren't removed, so it just keeps piling up more and more instances.
    I've sent you a reproduction case as a personal message.
     
  4. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    This sounds to me like the problem I explained about the prefabs: the generator being part of a prefab, it cannot delete the old copies. But I wanted to give it a try and see by myself if this was the problem, instead of asking you. But unfortunately the package had compilation errors,so:
    1. Can you confirm to me that your generator is not part of a prefab?
    2. Can you tell me what version of Unity you use for this project? Also, does it need any specific packages from the package manager?
    Thanks
     
  5. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    The generator is part of a prefab, that's the whole point, right? But the generated objects are not part of the prefab.

    I don't see how it can add objects, but not remove them again. They're part of the scene...

    I'm using Unity 2021.3.15f2
    It shouldn't require any special packages.
     
  6. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    I've been looking at the code. So "CreateGameObject" has a list of references to the objects it has spawned (m_Resources). Sometimes, all references are suddenly null, and it can't destroy them. This is when it doesn't clean up properly.
    Usually, it cleans them up correctly, though.

    I don't know what causes the references to be invalid, though. I've checked the stacktrace and in both times the call hierarchy is identical. But maybe it shouldn't refresh / create new objects, when the old references are invalid.
     
  7. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    For other users who might have this issue, m_Resources, which is a list of the created resources, is serialized. This makes it part of the prefab. Those created resources are children of the module which created them. That list and the module's children need to stay consistent.
    The list is updated at every refresh, keeping things consistent, but it is set back by Unity to its prefab value (ignoring the current changes) under certain conditions, creating an inconsistency. Curvy 8 will handle this properly.
     
    Orion likes this.
  8. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    atomicjoe likes this.
  9. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
  10. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
  11. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi everyone,

    I am excited to announce that Curvy 8.0.0 is released. I have been working on this upgrade for a year and half, and it is by far my biggest release. The release notes have more than 150 items. Here is an overview of the upgrade:



    If you bought Curvy after January 31st 2021, Curvy 8 is available to you for free. If you bought it before that date, you will have access to a special discount.

    I hope you will all find this upgrade valuable.

    Have a nice day
     
    bac9-flcl, iddqd, atomicjoe and 2 others like this.
  12. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Can Curvy constrain a 3D rigidbody to follow a spline using physics velocity?
    I haven't found anything about this specific topic in the docs.
     
  13. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Great updates, thank you!
     
    Aka_ToolBuddy likes this.
  14. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi
    Yes it can, this is what is done in example scene
    There is the example scene 11_Rigidbody where a sphere is pushed towards a spline, but I guess you want the position to be really on the spline, not around it right? In that case, you can modify SplineController.InitializedApplyDeltaTime to make the controller apply a velocity instead of changing the position of the object's transform (last few lines of the method)
    Did this help?
     
  15. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Your are welcome, glad to see that you love the upgrade. You are my first verbal feedback, and it is reassuring :)
     
    Last edited: Feb 3, 2022
    C_p_H likes this.
  16. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I does. Thanks.
    Would you consider implementing a proper "physics mode" into Curvy so that objects following Curvy's splines interact correctly with rigidbodys?
    Other spline tools in the store have that but I would rather use Curvy.
     
  17. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Good suggestion. Added it to my backlog.
     
    atomicjoe likes this.
  18. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    I just picked up Curvy and I’m super impressed with the UX for drawing and editing splines. Great work!

    I want to build some simplified movement with speed reduction on hills and acceleration on downward slopes. Are there any examples of this already written?
     
  19. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi

    Thanks for the praise, glad that you are finding Curvy Splines useful.

    In the example script E98_CurvyCamController, you can see a spline controller that was inherited to add to it some functionalities. One of them being, as you can see in the Advance method, to increase or decrease the speed depending on the tangent of the spline (used to get the slope). It's not complicated code, and you can modify it if needed to better suit your needs.

    I hope this helped. If and when you feel like it, please leave a review for the asset, that helps a lot.

    Have a nice day
     
    dock likes this.
  20. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    Thank you, that code is exactly what I needed. I'm looking forward to using Curvy more and I'll write a review when I have some experience with it.
     
  21. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Hi. I have recently purchased the Curvy Splines plugin and I was testing controller functionality. I've noticed that there is some weird speed variation, even thought the controller movement mode is set to Absolute. The speed variation gets more noticeable if you place two Catmull-Rom control points close to each other. I've tested this in a different plugin, and with that plugin, the movement speed seems to be uniform, as expected.
    Is there something I can do to fix it in Curvy?

    P.S. There is also some issue with the Curvy Line Renderer component in that example, which the other plugin seems to handle fine.
     
  22. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi
    Can you please send me your scene so that I use it for debugging?
    Thanks
     
  23. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Sent you a direct message with the link to a sample project.
     
  24. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi
    I took a look at your project. The first segment of your spline is overstretch (it goes back and forth if you did notice). The default Cache Density of the spline is not high enough in this scenario. If you set the spline's Cache Density to 100 and/or Max Points Per Unit to a higher value, both issues (the movement and the line render) will be solved.
    I hope this helped.
    Let me know if you have any other issue, and have a nice day
     
  25. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Thanks for a quick reply. Yes, I did notice it going back and forth, I scaled it this way on purpose to emphasize the problem, but the speed variation is noticeable in other situations too.
    I've tried increasing the Cache Density and Max Points Per Unit and it did help, but I've noticed that you have to increase these values pretty high for the problem to go away completely.
    Here's a screenshot of Cache Density = 100 and Max Points Per Unity = 10:
    I was wondering if it makes more sense to define sample rate per segment and not per unit as that should work better with short segments, where curvature can be more extreme than in the long segments?
     
  26. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Thanks for the suggestion. Defining sample rate per segment instead of per distance has definitely its advantages, but can be counter productive in some cases too. Whether per segment has more benefits than per unit is something I need to consider further.
    Regardless, the ideal solution would be that the controller should move correctly even with low sample rate. I will try to fix this in the future.
     
  27. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    It seems to work correctly, or at least better, if you set the Use Cache parameter of your controller to true. Not the ideal solution, but is enough for a lot of use cases.
     
  28. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Yes, Use Cache seems to be working much better. Thanks!
     
  29. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197
    im trying with Curvy make a ski lift for at test world but have this problem see the right seats angle if i fix them they are wrong angle when they are again at left side ride upwards how can i fix that?

    That they are always 90 angle always? like in real



    thank you so much
     
  30. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi
    Please read the the orientation related documentation available here: https://curvyeditor.com/documentation/splines/curvyspline#orientation
    I believe setting Orientation to None will always orient your objects the way you desire. If not, read the documentation for the other Orientation values, the solution should reside there.
    Did this help?
     
  31. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197
    thank you yes already read and tried much things over hours
    but cant get all to work because then they not move around whent at top or bottom of the SKI lift etc not find a good way that work then and not makes a new problem
    so Curvy cant handle this?
     
  32. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi
    Curvy is supposed to handle this. Can you please send me the reproduction case so I can see what's wrong and find a solution?
     
  33. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197
    yes i can send will prepare that you can import in an empty project for testing thank you so much

    SENDED in PM
     
    Last edited: Feb 15, 2022
  34. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi

    Tested your project, here is what I found:

    Here you can see that the collider and the mesh are not aligned, even though they are children of the same spline controller. That showed me that the two objects are misaligned without any implication of Curvy Splines. What further shows that is that the misalignment is still there even if I remove the Curvy Controller component in their parent object.


    upload_2022-2-15_14-43-25.png


    Digging in the hierarchy, I found that LiftSeatforSpline1 (X) has random rotation (values like 63.484 or 58.545), as well as it children D08 and 08. This makes everything complicated to handle. So what I tried to do is to make the rotations as simple as possible, as a good starting point to see clearly what happens:
    • Started by disabling the spline controller. Now I can freely modify the game objects independently from the spline data.
    • Set all the rotations to 0,0,0
    • I see that the used 3d meshes are not following the right axes. So I modified only the rotations needed to make the models align properly. Namely: D08 now has rotation set to 0, 180, 0 and 08 has rotation set to 270, 0, 0
    So at this point, you can see that everything is aligned properly.

    upload_2022-2-15_14-6-13.png

    This should be the prefab of the lift seat to use for all the other seat instances.

    Now it is time to activate the controller again. When you will do that, you will notice this:

    upload_2022-2-15_14-8-49.png

    The seat is now rotated. That's normal because the spline orientation is tilted. What you want is to ignore the spline's orientation. There is an option for this in the spline controller's inspector, which is setting Source to None in the Orientation section. Then set Lock Rotation to false. Then set the rotation of LiftSeatforSpline1 (X) to 0,0,0.
    You will get this:

    upload_2022-2-15_14-35-55.png

    Everything is aligned again. But since we ignore the spline's orientation, the seat will not rotate when reaching the U turn. This is not what you want. So a solution would be to ignore the spline orientation only partially. This is not something that is implemented in Curvy for now, but it can easily be done because the code was meant to be easily modifiable:
    I added a new orientation mode called Custom in the OrientationModeEnum enum. Then in the controller's code, in ComputeTargetPositionAndRotation, I added the following:

    Code (CSharp):
    1.  
    2. case OrientationModeEnum.Custom:
    3. {
    4.    Vector3 signedTangent = (m_Direction == MovementDirection.Backward && IgnoreDirection == false) ? -tangent : tangent;
    5.  
    6.    Vector3 right = Vector3.Cross(signedTangent, orientation);
    7.    targetUp = Vector3.up;
    8.    targetForward = Vector3.Cross(targetUp, right);
    9. }
    10. break;
    I will PM you the modified code.
    Now everything should work correctly.

    There is still a side note to add, but I will do it in the next post.
     

    Attached Files:

    hopeful likes this.
  35. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Now the side note: I noticed that much like what I said about the orientations, you have "random" values of scale in your hierarchy. For example, the spline has multiple parents having X scaling of 0.4, then 74.69527, then 0.07373347, and most of these scales are not uniform (meaning the scale value of X, Y, and Z are not equal). Using non uniform scales will make your objects move slowly in some direction compared to others. This is especially visible when the seat reaches the U turn. My advise is the following: rework your scene hierarchy and assets to make your objects all have the least rotations possible, and as much as possible a scale of 1,1,1. This way you will avoid issues whether it is while using Curvy Splines or other assets, and sometimes even unity's components. Plus it will make editing for you or any other person working on your projects easier.

    I hope this helped.
    If and when you feel like it, please leave a review for the asset, that helps a lot.
    Have a nice day

    Edit: here is how your spline looks once scaling is set to 1,1,1. Notice how the turn is not smooth. I set the scaling to 1,1,1 by dragging the spline outside of the hierarchy. I had to do the same for the generator to make the generated mesh scale accordingly
    upload_2022-2-15_15-44-54.png
     
    hopeful likes this.
  36. looytroop

    looytroop

    Joined:
    Jun 22, 2017
    Posts:
    70
    Hey! I am using the Curvy Generator to create static geometry prior to runtime. I using the Create Mesh node and I have checked "Combine Meshes" as well as "Group Meshes" and it seems that nothing changes. When I save to export the meshes it saves out hundreds of meshes as opposed to one. Am I doing something wrong here?
     
  37. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi looytroop. What version of Curvy are you using?
     
  38. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197

    thank you yes the Model was send from one who want test but he done everything wrong in 3D modler need fix that all yes


    Also is in Cruvy a Way when make more Lifts that can set how Much Seats and their position easier than Duplicate and set the Position and use Prefabs and not Objects in Scene to be assigned to Curvy?
     
  39. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Yes, just instanciate the prefabs using Unity's API, then use Curvy's API to setup the controllers' positions to spread them equally along the spline. The property that you will need the most is SplineController.Position
     
  40. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi
    I tried to reproduce it but couldn't. If you use an old version, please try it on the latest version. If you are already on the latest version, please send me reproduction case.
    Thanks
     
  41. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
  42. bconstantin

    bconstantin

    Joined:
    Feb 4, 2019
    Posts:
    15
    Hello,

    It does not work on ios because of an "Optimized constructor"
    Compile function is not authorized on ios platform. you can't do that !

    I posted a potential fix
     

    Attached Files:

  43. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Thanks a lot for raising this issue I was not aware of, and thanks also for suggesting a solution.
    I made a fix. Will send it to you via private message. If you can confirm to me that it works, that would be great
    Thanks again.
     
  44. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi everyone,

    Double announcement:
    Have a nice day
     
  45. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
  46. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    I've been happily using CurvySplines for a ton of time for AI but I think I'm also ready to move all my mesh generation needs from the external 3D tool to CurvySplines.

    I will perform mesh generation entirely in-editor, nothing at runtime in-game. What's the best way to ensure I will have zero overhead from the Splines and the Generator components while the game is playing? This will be for a mobile game so I just need to keep the generated static meshes at runtime.
     
  47. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi
    The best way is to export the meshes from the generators, and then disable the generators/splines.
    Please refer to the Export tab of the Create Mesh module to see what options you have:
    https://curvyeditor.com/documentation/generator/modules/createmesh#export

    And here are the API equivalents:

    https://api.curvyeditor.com/820/cla...module.html#a199bfd2c105f125ab8f63ded7f0e3346

    https://api.curvyeditor.com/820/cla...e_mesh.html#aab8f3e8cb57ecb890f6e70a7250cd161

    https://api.curvyeditor.com/820/cla...e_mesh.html#a747006998f285fb35164f8ce13e78e08

    I hope this helped
    Have a nice day
     
    DanjelRicci likes this.
  48. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    Thanks a lot, that's what I was looking for. :)
     
  49. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
  50. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    iddqd likes this.