Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to rotate generator asteroids
#1
Hi All - I'm relativelt new to unity, but not 2d/3d graphics. I followed this curvy spline generator tutorial to completion - https://www.youtube.com/watch?v=4Y_7l95Q4uQ.  I then attempted to get the generated gameobjects to circle the planet. I was able to get one gameobject to rotate using Spline animate, but no luck with the asteroids. I would appreciate it if someone could direct me to where I might look to solve this. My search thus far has resulted in little help.  Thanks, Dan  ttps://youtu.be/jUrpY9-8xhttps://yhoutu.be/jUrpY9-8xH4 https://youtu.be/jUrpY9-8xH4
Reply
#2
Hi,
I am assuming you want to rotate the asteroids in the example scene 28. If my assumption is wrong, please give me all the details you can about your use case.
Go to the Rasterized Path module in the scene's Curvy Generator, and increase its Range value. This will rotate the generated asteroids.
The reason is that this setting changes the start point of the range of rasterization on the spline. Since the spline is closed, and the range's length is 1 (the whole spline), changing the starting point will basically make the generated asteroids move further.
I explained above how to do this in the editor, in edit time. To do this at runtime, you need to either use an Animation asset to animate the value of the setting, or use the API to do so via code:
https://api.curvyeditor.com/FluffyUnderw...dPath_From
I hope this helped.
Have a nice day.
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
Another solution, that is more efficient but simple still, is to add a spline controller to each asteroid, and assign them random Offset settings, so that they are place randomly around the orbit spline.
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#4
Hi - thanks for the reply. I did as was suggested, but still nothing happened. 

I modified the Range to 100 in the Rasterize path node, then pressed the play button 

I added a spline controller to only the first asteroid in hierarchy where the only entry I changed was the Spline value in the General tab. I then went down to the preview tab and pressed play. 

Being a neophyte to Unity/curvy, there must be some action that is understood by those who know what they're doing that I failed to do. 

I have screen shots of my settings I attached. If it's not enough, I can upload the project.

I really appreciate your assistance and time with this. Thanks Dan


Attached Files
.pdf   unity curvy splines asteroids -upload.pdf (Size: 1.23 MB / Downloads: 1)
Reply
#5
Hi,
Here is some information that I believe will help you:
  1. A Curvy Generator (CG) generates objects each time you enter/exit playmode, and each time you modify a setting of the CG or its modules. Each time a CG generates objects, it replaces the existing objects.
  2. Generating objects every frame lead to memory allocation, which ultimately leads to garbage collection. A lot of effort was put into Curvy Splines to reduce this per-frame memory allocation, but it is not yet zero. Use the profiler and test on device to see if this memory allocation is problematic for your use case.
  3. There was an easier solution than the one I gave in my previous responses, I feel dumb to not have talked about it: just rotate the spline. For this to work, make sure your spline input module uses the splines's world coordinates.
  4. Once a CG generates objects, if you want to keep them and modify them (for example to add to them Spline Controllers), it is best to export the generated objects outside the CG, and then disable the CG. Otherwise, all your modifications will be discardes at the next CG update. To export those objects, the easiest way is to use the CG toolbar, which has a button to save all the CG resources/generated objects.
  5. A spline controller defines the position/rotation of its game object. It will override any existing position/rotation you applied or try to apply to it.

So to summarize, either you generate the objects each frame by rotating the spline (quick to implement but consumes more resources), or you generate them once and add to them properly parametrized spline controllers (longer to implement, but resource efficient). Another solution that needs more coding is to write code that both instantiates the asteroids and moves them using Curvy Spline's API. To be able to properly guide you, I need to know if you can code or not.
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#6
Hi:
    Sorry for the delay in responding.  I've been in IT for some 30 years. I've done a lot of coding on a lot of platforms (including web), but sadly I have not touched any version of C in over 25 years, especially in a game engine environment. I have worked on 2D/3D graphic designs and animations as a freelancer. I am relatively new to Unity (just a few months), but I do understand the concepts, as they are within the industry standards of other packages, such as Blender.
   First, I really do appreciate the assistance, as what i am finding it that, just like Blender, a lot of 'how-to' videos do not keep up with the current versions, so it takes a lot of hunting and pecking to migrate or create projects in an efficient manner.
   If possible, I would like to avoid as much C# coding as possible, as for the moment, I am just too rusty.  Again, thanks for your attention and help.  Dan
Reply
#7
No worries about the delay.
So if you want to avoid C# coding, you can use the two solutions at the end of my previous message. You can use Unity's animation feature to animate values without coding, whether it is a transform value (rotation of the spline for example) or a spline controller value (position and offset for example)
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I have to refresh generator manualy :( GameDeveloperek4123 4 526 10-07-2024, 05:36 PM
Last Post: _Aka_
  Bug: Save Generator Outputs still saves outputs if object is disabled curvymesher 1 261 08-30-2024, 09:19 AM
Last Post: _Aka_
  How can I set the generator to stop updating? emerrryjones 1 320 07-26-2024, 10:07 AM
Last Post: _Aka_
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 1 281 04-03-2024, 03:16 PM
Last Post: _Aka_

Forum Jump: