Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[Published] Spline plus- Spline mesh deform

Discussion in 'Assets and Asset Store' started by elseforty, May 21, 2018.

  1. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    Spline path finding will be published in few weeks , it is actually ready, i just need to get the screenshots , demo video and documentation done
    concerning Spline mesh deform, yes it has Spline plus included
     
  2. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    Im working on a new documentation web sites to organize things better,
    the Spline Plus Documentation is ready and can be checked it from here Documentation
    i'll add the Spline Mesh Deform documentation latter next week
     
    Last edited: Jul 5, 2020
  3. Kiragan-Games

    Kiragan-Games

    Joined:
    Jan 8, 2016
    Posts:
    20
    Hi,

    Снимок экрана 2020-01-11 в 1.52.37.png

    What im trying to do, is interpolate blue cube (follower) between start and end nodes, depending of player z movement (yellow ball)

    Very fast solution (as i thought :D ) is to get:
    a) Start node world position
    b) Last node world position
    c) Max Progress between them, literally its the value when follower is on the last node.

    And then interpolate progress value using player z position between start and last nodes.

    But, i cant get these nodes via api, would appreciate if you could provide me how to get start and last node, and how to get max Progress value, because on last node im getting something like 62.323 value, not 100 like i thought.
    Spline is not looped, all movements are on Z axis only.
     
  4. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi @Kiragan ,
    i see what are you trying to do, let me know if this helps solving your issue,
    Code (CSharp):
    1.  
    2.  
    3.          //i'm assuming you have only one branch this is why i set the branch key to 0
    4.         var firstNodePosition = SPData.DictBranches[0].Nodes[0].Point.position;
    5.  
    6.         var lastNodeIndex = SPData.DictBranches[0].Nodes.Count - 1;
    7.         var lastNodePosition = SPData.DictBranches[0].Nodes[lastNodeIndex].Point.position;
    8.        // progress is literally the length of your branch , it is not a value between [0,100]
    9.         var maxProgress = SPData.DictBranches[0].BranchDistance;
     
  5. Kiragan-Games

    Kiragan-Games

    Joined:
    Jan 8, 2016
    Posts:
    20
    Yes, it works flawless!

    Thank you very much ;)
     
    elseforty likes this.
  6. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    Next update will have the option to save spline plus shape into a .SP file which you can open in another spline plus game object
    the .SP file will include the following

    - branches,
    - nodes,
    - shared nodes ,
    - projection settings,
    - spline settings

    the only thing that will not be shipped in a .SP file is the followers in case you have them in your spline plus game object

     
  7. LiveOverflow

    LiveOverflow

    Joined:
    Jan 27, 2019
    Posts:
    13
    Hello,

    Not sure if it is already possible and I just couldn't find it. If not, consider it a feature suggestion :)

    I'm using Spline Plus to create paths for NPC walking around. And I would like to trigger events on reaching certain nodes. This could be used to trigger opening a door or eg idling at one node for a bit before continue walking.

    I'm currently programming the progress of the follower game object by hand, but it would be more convenient if I can easier trigger events when reaching certain nodes or when traveled a certain distance.

    What's the recommended animation type, when I would like auto walking along the spline, but would also like to pause the movement, or let the object idle for a few seconds before continuing. Would be cool to do it directly from the GUI, but if it's possible through some API via script, I'm good with that too.

    But biggest feature for me would be triggering events when reaching a node :)

    Another question I have is regarding the automatic reversal. I would like the object to follow the path and then stop (at a certain node or at the end). At the moment I can only modify the source scripts to disable that.

    Thanks!
     
    Last edited: Feb 9, 2020
  8. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    @LiveOverflow
    Hi,
    concerning events triggered when reaching a certain node , i can do something to make this possible, probably it is gonna be in the next update,
    i can picture this as few extra settings in the event section
    more particularly a drop down list for event type (branch/node)
    the rest of the settings bellow will depend on the event section value selected above,

    concerning the second question, i think auto animation is the animation type you should use, concerning pausing the movement i believe you should use events for that, you can stop the follower by setting the IsActive to false then call a function that will trigger the IDLE animation as well,
    concerning the follower IsActive value, you can create a function like bellow and schedule it in the event with the IDLE function as well
    Code (CSharp):
    1.     public void MoveStopFollower(bool value)
    2.     {
    3.         SPData.Followers[SPData.Selections._FollowerIndex].IsActive = value;
    4.     }
    for the third question, to do this,( i mean the follower stops at the end of a branch if there no other branch to take,) you need to modify the source code,
    look for FollowerClass.cs and comment the line 117 follower.Reverse = !follower.Reverse;

    let me know if this works for you,
     
  9. LiveOverflow

    LiveOverflow

    Joined:
    Jan 27, 2019
    Posts:
    13
    Thanks for the quick response!
    I have written my own Event system now, where I choose a "distance/progress" and the event I want to trigger. And I check the progress of the follower in an Update() function for the distance to be reached. works actually quite well. But I believe such a feature (Event trigger on nodes, progress or branch) would be really cool! Thanks for considering it.

    I have another small issue. As I mentioned, I'm using this to move NPCs on a path - so I use the projection feature. Which works most of the time very well, but I have weird parts on my map where the projection glitches. And I don't really know why. In this video I'm showing you the progress and also a bit the game objects around it:


    edit: I figured it out. I looked into the source code of how you detect the ground. And my sphere collider that I'm using to trigger events for the NPC, happened to be caught by the follower.
    I'm modifying now the code to use the layerMask paramter so I can have layers that are being ignored. That could be another useful feature to implement :)

    kind regards
     

    Attached Files:

    Last edited: Feb 9, 2020
  10. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    it is using raycasting , i guess it is hitting something other than the ground's collision, maybe try to make the ground ray length shorter and see,
    concerning layers, i will see if i can add this in the next update, in the meantime you can set layers through script,
    the file that contains the projected path following logic is FollowerClass.cs, look for a method called FollowerProjection()
    let me know if this works for you,
     
  11. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    @LiveOverflow Hi,
    i managed to add the features that you have requested to Spline plus,
    * Events triggered when reaching defined Nodes
    * Layer mask for Projected path following
    there is high chance that i will manage to squeeze them in the next update if it gets through tests
    a little images

     
  12. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    @rocket2guns
    Delete shared nodes added,
    the function will be included in spline plus API too for the next update
     
  13. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    New Online documentation is ready, you can check it out from this link https://elseforty.github.io/unity/
    the new version of spline plus will have massive runtime API improvement, all editor methods are going to be shared with the runtime API , please check the new API Documentation in the documentation link above.
     
    Last edited: Oct 15, 2020
  14. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,684
    @elseforty
    Hi there!
    If I had a mesh, that was a half pipe, 10x10x10 in world space units, could I use your asset to create a long, twisting slide?

    And if I plan to use for mobile, should I be concerned about performance?


    Thank you!!!
     
  15. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi renman,

    there should be no problem, the slide mesh generated with spline mesh deform will be treated as a regular mesh, there will be no overhead on the performance unless you intend to modify the shape of your slide in real time,

    Best regards,
     
    renman3000 likes this.
  16. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    new massive Update is going to be dropped for Spline Plus and Spline Mesh Deform, all is scheduled for next week if everything went okey,
    Online documentation has been updated to cover the new updates, you can check it to see what is new

    Some screenshots:
    New inspector


    Scene view items menu


    Events


    Major changes:
    Spline Plus:
    • New intuitive inspector UI.
    • New Events system,
    • Massive API improvements
    • New logic for shared nodes
    • Append and Save spline data using ".SP" files
    • Projected path following simplified and improved
    • New shortcuts added
    • Scene view UI replaced with a right click items menu for simplification and efficacy
    • Documentation improved and updated



    Spline Mesh Deform:
    • Inspector Prefab meshes Editing actions replaced with a right click items menu in the prefab meshes area.
    • New prefab mesh action added : Copy,Paste,Paste to all branches, Duplicate, Clear all.
    • Mesh trimming bug fixed for GPU and MultiThreading processing
    • Documentation improved and updated
     
    Last edited: Oct 15, 2020
  17. joseaterol

    joseaterol

    Joined:
    Jun 7, 2020
    Posts:
    1
    Hello,
    I bought SplinePlus some time ago, now I need it and have a couple of doubts.

    - I need to place a specific number of instantiated prefabs on a spline, it is a production chain with hooks at a specific distance.
    -I have a json file with a specific spline and I need to import it into SplinePlus, is it possible?
    Thanks a lot.
     
  18. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi Jose,
    to answer you properly, i need to check the json file you have,
    can you send it to me at elseforty@gmail.com

    Thanx
     
  19. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi Everyone,
    i have submitted the new version of spline plus 4.0 to the asset store team for approuval
    this new version of spline plus has so many new features and improvements,
    here is a list of the main ones

    - New Spline modeling tools added
    - New intuitive inspector UI.
    - New Events system logic
    - Massive API improvements
    - New logic for shared nodes
    - Smart Keyboard navigation
    - Export/Import ".SP" files
    - Copy/Paste Spline Plus data
    - Projected path following simplified and improved
    - New shortcuts added
    - Scene view UI replaced with a right click items menu for simplification and efficacy
    - Reflexion removed and replaced with delegates to communicate with other plugins efficiently
    - Documentation improved and updated
     
  20. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    New Modeling Demo


    New Animation Demo
     
  21. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi Everyone,
    i have submitted the new version of Spline Mesh Deform 4.0 to the asset store team for approval
    this new version of Spline Mesh Deform has so many new features and improvements,
    here is a list of the main ones

    Spline Plus:
    - New Spline modeling tools added
    - New intuitive inspector UI.
    - New Events system logic,
    - Massive API improvements
    - New logic for shared nodes
    - Smart Keyboard navigation
    - Export/Import ".SP" files
    - Copy/Paste Spline Plus data
    - Projected path following simplified and improved
    - New shortcuts added
    - Scene view UI replaced with a right click items menu for simplification and efficacy
    - Reflexion removed and replaced with delegates to communicate with other plugins efficiently
    - Documentation improved and updated

    Spline Mesh Deform:
    - Inspector Prefab meshes Editing actions replaced with a right click items menu in the prefab meshes area
    - New prefab mesh actions added : Copy,Paste,Paste to all branches, Duplicate, Clear all
    - Mesh trimming bug fixed for GPU and MultiThreading processing
    - Documentation improved and updated
    -" Bug fixed" null ref exceptions when adding prefab meshes that have no mesh renderer or mesh filter components </br> -Placement value in deformation mode bug fixed
    -New UI arrangement

    Extrude:
    -Extrude, body, cap, both
    -Extrusion axis added
    -New UI arrangement
    -UV Rotation added

    Plane Mesh:
    -New UI arrangement
    -UV Rotation added
    -Reference axis added

    Tube Mesh:
    -New UI arrangement
    -UV Rotation added

    Spline Mesh Deform Demo
     
  22. Digot

    Digot

    Joined:
    Nov 4, 2014
    Posts:
    11
    Hi there this is looking really promising for my project. Few questions because I'm not too sure if your asset does fit all my requirements:

    * Can you decide which spline is the next for a spline follower/walker when on a junction via code?
    * Can you do custom mesh deformations for a junction or a crossing? I would use the splines for rails and whenever two rails cross each other there should be little gaps in the mesh.
    * When joining/connecting two splines do the spline automatically align the connecting control points so there is a smooth transition between the splines?
    * Is spline mesh deform including spline plus or do I have to buy spline plus in order to make spline mesh deform work?
    * Can you animate the splines to animate the mesh (e.g. make railway junctions change direction)

    Thank you in advance!
     
  23. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    @Digot
    Hi,
    Thanx for your interest,
    to answer your questions,
    - yes, you can do that either with events which will allow you to pick the next branch to take based on your keyboard inputs or via scripting,
    - no it does no support custom mesh deformations for junctions, but if you want to use that for rail roads then i think it will look fine here is a picture showing the junction with a rail road mesh,
    https://drive.google.com/file/d/1AfufP-VBgIJY75QxNT9j1fHbAqwxRNdI/view?usp=sharing

    - i don't know exacltly what you mean by that but i can tell you that it snaps perfectly, the issue that you may encounter is curvature(left or right) which you will need to write some code to make it fits your project needs,
    - yes you can animate the spline and with it you can animate the generated mesh too,

    Best regards
     
  24. Digot

    Digot

    Joined:
    Nov 4, 2014
    Posts:
    11
    Thank you very much!

    Just another few questions:

    * Is spline mesh deform including spline plus or do I have to buy spline plus in order to make spline mesh deform work?

    * The image you showed: https://drive.google.com/file/d/1AfufP-VBgIJY75QxNT9j1fHbAqwxRNdI/view?usp=sharing. Do the branching splines automatically align so they look like in the picture with the smooth transition between the splines or do I need to do that by myself by changing tangents/handles?

    * Can you automatically place objects along the spline? And also set properties like offsets, gaps, materials, angle limits?

    * Can you limit the spline mesh extrusion to a certain range of the spline? For example if I wanted to let the mesh end 1 meter before the end of the spline without changing the spline (so I can place a junction there and still let the train follow the spline)

    * Is pathfinding implemented?

    * Is it compatible with VR?

    * Hows the performance with many meshes and if I place many objects along the spline with the same mesh and material, will they be batched together or be drawn instanced?

    Thank you!
     
    Last edited: Apr 15, 2021
  25. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    to answer your questions,
    - yes spline plus is included in spline mesh deform,
    - yes they automatically align , no manual manipulation is needed
    - yes you can do that but you have to dig into the source code
    - no it is not supported, curently the whole branch is used for procedural mesh generation
    - no spline path finding is not included
    - i don't know what do you mesh by vr compatible, can you be more specific
    - performane is great, you can use GPU or CPU Multi threading processing to boost things up if needed,
    * for batching , spline mesh deform works differently, it groups meshes together to form one final big mesh for each branch, so this is a big performance gain, instead of having hundreads of meshes,
    * materials can be shared between sub meshes of the branch final big mesh
    one thing to mention that final big meshes are limited to the unity vertices limit of 64k vertices, if you want to exceed that you need to break the branch

    Best regards,
     
  26. Digot

    Digot

    Joined:
    Nov 4, 2014
    Posts:
    11
    Thank you very much for your answers, just bought it.

    One big request from me would be automatic mesh seperation if there are too many vertices. (or maybe use 32-bit index format?). Currently seems like a pain because I would have to guess when my spline is too long, and if it's too long, the SplinePlus script throws an exception and stops working which means I have to re-add the component.

    Also the "Processing" property always switches back from "GPU" to "CPU Single Threaded" for me automatically when selecting another GameObject and then going back to the spline.

    Is it not possible to have seperate splines which seperate modifiers that can still be connected to each other? For example I want rails to have different rail meshes but the rails (splines) still conntected

    Additionally the plugin is "breaking" my editor view. After doing some Spline Plus related things, I just have the hand cursor and can't click anything, also not right-click anything unless I disable Gizmos and re-enable them again.

    EDIT: I'm really sorry but this plugin seems too unstable for the price as well as it's not working properly and doesn't have some features that a spline plugin should have (as written above). Could you provide me a refund? Would appreciate it.
    EDIT2: Also spline mesh deformation doesn't work for me: upload_2021-4-16_16-35-58.png
     
    Last edited: Apr 16, 2021
  27. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi Digot,
    yes you can have complete different mesh for each branch,
    can you share with me a simple project of what are you working on and tell me exacly what do you want to achieve,
    if there is an issue with my plugin that cannot be solved then you will be granted refund,
     
  28. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    @Digot to fixe the issue of processing getting back to CPU single thread when changing selection just comment this line 25 in DeformedMeshEditor.cs
    // else DeformedMesh._Processing = Processing.CPUSingleThreaded;
     
  29. Digot

    Digot

    Joined:
    Nov 4, 2014
    Posts:
    11
    Uploaded a sample project reproducing the problems:

    https://we.tl/t-dr1C59Jlzq

    I have set up the purple path for only one branch but the other branch also has it.
     
  30. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi @Digot
    seams like you are trying to deform a mesh that have litteraly 0 subdivisions in the middle, that is why you are getting this result, you need to modify your mesh by increassing subdivision in the middle so it can line up perfectly with the spline,

     
  31. Digot

    Digot

    Joined:
    Nov 4, 2014
    Posts:
    11
    If I use the same mesh with Dreamteck Splines it works properly.
     
  32. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    technicaly you can achieve this with one trick, and it is by decreasing the scale on the z axis and increace the tiling,
    this is not a good idea in term of perfomance, the better way to go is by increasing subdivisions in the middle,

    i left a little gap between so you can better see the scale effect on your rail road meshes
     
  33. Digot

    Digot

    Joined:
    Nov 4, 2014
    Posts:
    11
    Well I appreciate your effort but also since there are also still three of my problems that you haven't addressed, which some maybe can't even be fixed quickly, I would really appreciate a refund.
     
  34. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
  35. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    i will drop a new update with a couple of fixes and new features for Spline Plus and Spline Mesh Deform

    Spline Plus,
    - fixe the Train follower modifier not being detected
    - add close button to all scene view popups



    - Diffuse node can now be performed on a non shared nodes

    -Node scale can now be previewed using the helpers instead of mesh only


    Spline Mesh Deform
    - Add Shell Extrusion to extrude modifier

    - huge Improvement for Mesh deform modifier performance

    i will also start adding new video tutorials for the version 4.x since it has masivliy changed compared to older versions , the old tutorials are not very usefull at this moment
     
    Last edited: Apr 26, 2021
  36. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi everyone
    please check the new introduction video tutorial of spline plus version 4.x, i've received requests from users to make this,
    somehow old video tutorials are not very helpful, the difference between old and new version is now significant
    anyway hope it helps, i'll add more in the next few days,
     
  37. GameFDev

    GameFDev

    Joined:
    Jul 13, 2020
    Posts:
    10
    Hello,

    We are having trouble with Spline Mesh Deform. We are modifying the mesh at runtime, moving it up and down everything works great except one problem. Unless we click on the gameobject with spline mesh deform component in the editor, runtime deformations do not work, nothing happens. What are we missing here?

    Best regards
     
  38. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi,
    can you upload me a simple project so i can have a look at it closely,
    you can send it to me at elseforty@gmail.com
     
  39. GameFDev

    GameFDev

    Joined:
    Jul 13, 2020
    Posts:
    10
    Thank you for the prompt reply. Someone on the team managed to fix it but he did bunch of stuff together and one of them apparently fixed the issue :)
     
  40. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    glad it is working, if you face any other issues let me know,
    best regards,
     
  41. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    Hello, I am considering purchasing SplinePlus but had a few questions.
    1. Is it possible to implement a "lookAt" capability as a character moves along the spline? I don't want to alter the normal of the spline (and hence the character's main upright orientation), but instead wish to have the character "lookAt" things based on his position. If this capability exists, can I provide values at the Control Points and have Spline Plus interpolate a lookAt Vector or Quaternion (the way it interpolates other things like Speed, Normals etc.)
    2. Does Spline Plus allow the user to store their own data on branches and nodes?
    3. Would a "network" of a few hundred control points and branches cause any scale (or other) issue?
    4. I assume I can extrude a whole set of interconnected control points and branches? In this case what happens at "junctions". Is that extruded correctly or does one need to put in a special "junction piece"?
    5. I noticed what seem to a lot of straight lines and (seemingly) arcs in Spline Plus. Incidentally, I consider this a plus. What is it that causes this? I didn't see anywhere in your demos where you were setting a "branch type" to be say (Line).
    6. If I have a large "network" of control points and branches, given two points (or branches) is there a shortest path algorithm available, or would I have to bring my own algorithm?

    thanks in advance.
    .
     
  42. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    ok, I went ahead and bought Mesh Deform and I'm kind of shocked. None of your classes are in a namespace. This is causing me compilation errors in other projects.

    I strongly request that you create an update where all your classes are in a namespace like (say) MeshDeform or ElseForty. Otherwise this is like playing with fire for customers that have other packages.

    In the meantime do you have any workarounds short of uninstalling your package and requesting a refund?
     
  43. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi @villaman ,
    sorry to hear that you are having troubles with spline mesh deform, can you email me the issues that you are having with spline mesh deform, if no fixe is found i will gladly provide you with a refund
    also make sure you have Burst installed, if it is not then probably the exceptions that you are getting are because of that, anyway email me at elseforty@gmail.com
     
  44. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    @villaman contact me at elseforty@gmail.com i have added namespaces, i can send the new modified package to you if you don't want to wait until the next Update
     
  45. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    Thanks for looking into this package issue. I think it will generally benefit your package anyway. When will this new update with namespaces be posted? If it will be a few days I will just wait. Otherwise, I'll email you for the modified package with namespaces.

    In the meantime, I had a few questions.

    1) Is there a way to implement a "lookAt" vector for a Follower? Essentially I need my follower (which is a first person camera) to be rotated to "look at" various directions while still moving along the tangent direction. I want the follower to be rotated, not the underlying spline. The idea is that I would set the lookAt vector at various nodes and the actual lookAt vector would be interpolated between these points just like other properties are interpolated. If the lookAt vector is not set, the follower would look straight ahead (i.e. the normal tangent path). However, if the follower lookAt is set, it would rotate to the interpolated lookAt vector rather than the tangent vector.

    The problem with rotating the underlying spline to produce the follower rotation, is twofold. Let's take a simple example of a planar spline in the XZ Plane with the follower running along it upright along the Y-axis. Now if one wants to show the path visually, presumably the best way is to just generate a mesh from this spline. However, if the mesh is rotated, then one gets an oddly twisted path mesh. Maybe one way to overcome this is to have two splines, one for rotating the follower and the other for mesh operations. However, the second problem is that even if one uses a separate spline, the rotation produced is not what one wants. The rotation seems to be normal to the path. This creates the effect of the follower leaning (in general some rotation about the X and Z axes) rather than a follower looking around (rotation about the Y axis).

    2) I couldn't find the API to do create a plane mesh or tube mesh from a spline.

    3) What is the best way to visualize the spline in Game mode? Currently, I only see the spline in Editor mode.

    3) I couldn't find the Path Generator class that I saw in one of your videos. The one that essentially given a set of points, generates auxillary points for junctions and curves.

    4) Is there a way to control texture UV scaling on generated meshes? Currently it uses some particular scaling that may or may not look good.
     
  46. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    Hi Villaman,
    the next update will be live by next week, if you are in a hurry i can email the modified package to you,

    to answer your questions
    1)i understand the first part so i'll try to answer it, for the second part , i need a visual maybe a screen record video from Unity so it can help me understand better your idea
    to make the follower look at a transform you just need to override the spline rotation data passed to the follower and replace it with the unity lookat method rotation data
    you can do this in the TransformFollower(Follower follower) method found in the SimpleFollowerAnim.cs

    Code (CSharp):
    1.     public static void TransformFollower(Follower follower)
    2.     {
    3.         //transform assign
    4.         follower.FollowerGO.transform.position = follower.DistanceData.Position;
    5.         if (follower.SpaceType == SpaceType.Local) follower.FollowerGO.transform.Translate(follower.Position);
    6.         else follower.FollowerGO.transform.position += follower.Position;
    7.  
    8.         if (follower.LookAtTransform != null) follower.FollowerGO.transform.LookAt(follower.LookAtTransform);
    9.         else
    10.         {
    11.             if (follower.LockRotation == Switch.On) follower.FollowerGO.transform.rotation = Quaternion.Euler(follower.Rotation);
    12.             else follower.FollowerGO.transform.rotation = follower.DistanceData.Rotation * Quaternion.Euler(follower.Rotation);
    13.         }
    14.  
    15.        // if (follower.Projection == Switch.On) Projection(follower);
    16.     }
    before you do that you need the transform that your follower will be looking at, you can add it to your follower class found in SimpleFollowerClass.cs




    now the look at should work , the rest which is changing the look at transforms should be done using Spline Plus Events , this is how it looks


    you will be calling this method bellow to change the look at transform when follower changes its branch,

    the method triggered in the events looks like this
    Code (CSharp):
    1. public class LookAtTransform : MonoBehaviour
    2. {
    3.     SimpleFollowersClass simpleFollowersClass;
    4.  
    5.     // Start is called before the first frame update
    6.     void Start()
    7.     {
    8.         simpleFollowersClass = GetComponent<SimpleFollowersClass>();
    9.  
    10.         //initialize the follower to look at "LookAt1"
    11.         ChangeLookAtTransform(GameObject.Find("LookAt1").transform);
    12.     }
    13.  
    14.     public void ChangeLookAtTransform(Transform newTransform)
    15.     {
    16.         simpleFollowersClass.Followers[0].LookAtTransform = newTransform;
    17.     }
    18. }
    19.  
    now the rest is figuring out how would you do the transitions

    a little demo i recorded
     
  47. elseforty

    elseforty

    Joined:
    Apr 3, 2018
    Posts:
    289
    2) i still have not included API to generate mesh for plane mesh and tube mesh, but if you are a programmer you can check the source code to figure things out, it is similar to mesh deform and it is much more easier, you can contact me in case you need help

    3) you cannot visualize spline in game play mode, gizmos are a unity 3d editor thing, the solution is using a mesh, you have plane mesh and tube mesh, chose the one that you think fits best for your project,

    3) that was deprecated and removed starting from version 2, now you have new options that will help build splines quickly such as the import/export , copy/past etc .

    4) you have a uv's method on the Plane mesh Tube mesh and extrude mesh, you can customize that in case you want to achieve a particular result different than the default one .

    Uvs method used for Plane mesh, it can be found in PlaneMesh.cs
    Code (CSharp):
    1.         public void Uvs(Branch branch)
    2.         {
    3.             uvs = new Vector2[vertices.Count];
    4.             float h = branch.Length / (Width * 2);
    5.             for (int n = 0, i = 0; i < branch.Vertices.Count; i++, n = n + 2)
    6.             {
    7.                 var x = Mathf.InverseLerp(0, branch.Length, branch.VerticesDistance[i]) * h;
    8.  
    9.  
    10.                 uvs[n] = new Vector2(x, 0);
    11.                 uvs[n + 1] = new Vector2(x, 1);
    12.  
    13.                 uvs[n] = SplinePlusAPI.Vector2_Rotate_Around_Pivot(uvs[n], UVRotation);
    14.                 uvs[n + 1] = SplinePlusAPI.Vector2_Rotate_Around_Pivot(uvs[n + 1], UVRotation);
    15.             }
    16.         }
     
  48. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    Thanks for your reply. I'll wait for you to publish the official package with namespace(s). In the meantime, I've changed some class names which were causing name collisions. Obviously this method won't work long-term as any upgrade would undo those.

    Regarding the additional questions I had, my comments below

    1) Your LookAt code almost does what I need except for the interpolation. I'll describe it in more detail in the next message.

    2) ok, I'll try to look into the code to invoke plane mesh generation and tube generation. I'll email you if I run into difficulties. You might consider adding those to your API :)

    3) that's what I thought regarding visualization, just wanted to make sure.

    3) I see. I'll figure a way out to build this functionality. Essentially I want to specify junctions as "logical" junctions and have the script generate "physical" junctions.

    4) ok, I'll give the UV method on PlaneMesh a try. I've just seen most tools give a simple way to scaleU and scaleV and shiftU and shiftV. Those transforms are usually sufficient to pull off most cases. I'm unclear on how vertices play into this as my UV knowledge is not that great. I've added a screenshot with a common pattern I've seen. UV Scale and Shift Controls.png
     
  49. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    ok, on to more detail regarding LookAt. As I mentioned in my previous comment, your code does most of what I need other than the LookAt interpolation. The basic idea is to interpolate the LookAt vector just like Spline Plus currently supports interpolation of the velocity vector. If you imagine walking past a room and you are looking at something, usually one would not just snap one's head from one LookAt to another, but rather one would smoothly turn one's head.

    Hopefully the illustration below will show what I mean. Essentially, I need a way to interpolate between LookAt Vectors along the spline. If Node N1 has LookOut L1 and Node N2 has LookOut L2, then I need to interpolate between L1 and L2 as the player walks between N1 and N2. Similar to how the velocity vector would be interpolated between V1 and V2. Of course a special case of that would be no interpolation, in which case the player's head "snaps" at the Node the way your code above does.

    LookAt Interpolation.png

    Hopefully, this explains my requirement more clearly.
     
  50. doukisan

    doukisan

    Joined:
    Nov 26, 2015
    Posts:
    15
    Hi! I'm searching for a spline asset which I could use to make 3D "islands" with premade tile border assets (just like your road with lights example), but for this I would need a Cap function to make the top part of this model.

    Imagine a circle made with Spline Plus. The edges would be the model (like the road, but to serve as the edge of the island) and the top would be a simple plane which I could assign a tiling material to match with the border's material.

    Would this be possible with Spline Plus? This is what I'm trying to achieve, but in 3D with splines: