Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Camera wobbles on too long spline (100km+)
#1
Hey there,

I have a problem with an long spline and my camera, which i tried to drive along the spline. The geometrie and so on was fine along this spline (afterwards i switched it and dont need to clone it along the spline any longer, but the camera remains). I experienced that my camera starts to wiggle after 30km and wont stop wiggling at 60km+ and at 100km+ its unusable.

What i have done so far:
I created my spline in Cinema4D and cloned some placeholders along the spline (~1750 pieces for 120km), then i imported the placeholders into unity and replaced the placeholderobjects with an prefab of an "CP0000" from and previously created curvyspline. Then i put these ~1750 "CP0000" back into the SplineController, which renamed the "CP0000" acordingly and everything was fine. Like i said i could generate my track along this spline and it looked good, but when i drive my camera along the spline it begins to wobble at certain distances, even if the spline looks great.
Now i tried to position the the controlpoints nearer or further from the SplineController and moved it acordingly around the origin to counter an floating origin (thats why the "Object to move" script is attached from the WorldMover Asset. Unfortunally this did not help and even increasing the "Cache Density" from 50 to 100 and the "Max Points Per Unit" from 8 to 16, 32 and 64 did not help, it just caused a massive framedrop.

So now i think that the origin and cache density does not act like they should, because it seems the only thing that matters is where the spline did start, because in the beginning of the Spline at "CP0000" the camera drives perfectly smooth, but when i get ~60km away from this point it starts to wobble. Its still perfectly smooth in the splinebeginning, even when the origin and the SplineController are 100km away, but the end of the spline which is at  this moment at the origin of the world and the SplineController still wobbles.

Now you could think "just split the spline into 40km parts and everything is fine" that may be true, but i need only 1 spline for this track, because i need to get the absolut position of my camera on the track in realtime to teleport to the right kilometer and to know where iam.

I captured some seconds of the end of the track, where you can see the smooth spline on the left and the wobbly cam on the right.




PS: The script for this process to know where iam on the spline was presented from you in an older support thread and still works fine
Reply
#2
Hi,

From reading this post, I think too that this is due to loss of precision due to the float representation. But it is not because of the floats used in the Position Vector3, but the float used by the controller to represent the progress along the spline. That would explain why moving things closer/further from world origin did not change the issue.
The said float is either between 0 and 1 wen setting Position Mode to Relative, or between 0 and 100km+ when set to Absolute. So could you please set both Move Mode and Position Mode to Relative and tell me if thinks work better?

And about splitting the spline to multiple smaller ones, I am trying to avoid this fix for now, but if it came to that, knowing where you are on the virtual long spline is doable with some simple logic. I will say more about that if we end up needing to subdivide the spline.

Is it possible for you to send me the reproduction scene/scripts? That would help me understand what is going on and what your needs exactly are.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Hi and thanks for the fast reply,

I can put the Spline Controller on Absolute "Position Mode" without any changes, but when i try to put the "Move Mode" to absolute i get the following error in runtime (not editor, because the camera is turned off at start):

Code:
[Curvy] Unexpected behavior in Spline Controller 'POI-02-Kamerafahrt-01'. Please raise a Bug Report.
UnityEngine.Debug:LogError(Object)
FluffyUnderware.DevTools.DTLog:LogError(Object) (at Assets/Plugins/DevTools/Classes/DTUtility.cs:800)
FluffyUnderware.Curvy.Controllers.SplineController:EventAwareMove(Single) (at Assets/Plugins/Curvy/Controllers/SplineController.cs:858)
FluffyUnderware.Curvy.Controllers.SplineController:Advance(Single, Single) (at Assets/Plugins/Curvy/Controllers/SplineController.cs:456)
FluffyUnderware.Curvy.Controllers.CurvyController:InitializedApplyDeltaTime(Single) (at Assets/Plugins/Curvy/Controllers/CurvyController.cs:627)
FluffyUnderware.Curvy.Controllers.SplineController:InitializedApplyDeltaTime(Single) (at Assets/Plugins/Curvy/Controllers/SplineController.cs:500)
FluffyUnderware.Curvy.Controllers.CurvyController:ApplyDeltaTime(Single) (at Assets/Plugins/Curvy/Controllers/CurvyController.cs:976)
FluffyUnderware.Curvy.Controllers.CurvyController:Update() (at Assets/Plugins/Curvy/Controllers/CurvyController.cs:557)

About the testscene i have to ask my employee and have to prepare the scene for you, which wil not be done until tomorrow
Reply
#4
(07-29-2019, 01:14 PM)Vectorvision Wrote: I can put the Spline Controller on Absolute "Position Mode" without any changes, but when i try to put the "Move Mode" to absolute
What I am interested in is to have them both set to Relative. Should I understand from your answer that you already had them both set to Relative in the first place?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
(07-29-2019, 01:14 PM)Vectorvision Wrote: i get the following error in runtime
I take note of that
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
I send you an PM and hope you can find and resolve the problem

Thanks in advance and dont bother to ask me, if you need additional informations
Reply
#7
For future reference:

The spline did not come from the controller, but from the code computing the spline's tangent. That code does not give precise enough computations when it comes to very long splines

I am aiming at enhancing that code for the next release. Until then, a work around is to use Direction Damping Time and Up Damping Time to non zero values. This will smooth the tangent and direction used by the controller:
https://curvyeditor.com/documentation/controllers?redirect=1#direction_damping_time
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#8
Thumbs Up 
I set both of them to 1 and it works, seems a bit funny when you teleport onto the spline and have to change rotations, but the camera drives smooth along the spline.

Thank you again for the fast and accurate support Heart

PS: changing directions while driving along the spline looks even more funny, because i need a minimum of 0,5 for damping, but the wiggle is gone. Looking forwards to future releases with the enhanced code
Reply
#9
Hi,
Thank you for your appreciation
About the damping duration, 0.5s seems too long for me. In my tests I used 0.05s and the result was good.
Just in case, have you seen that I have sent you private messages?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#10
Sorry, but i didnt get an email when i receive an private message, but now i read all of them and thanks again for the modified gizmo code, but before i used the workaround that i simple deactivate the gizmos for CurvySplineSegments in editor, so i dont get this massive FPS drop and just activate them if i had to modify them. Because i imported the spline from another program and switched the placeholders with the CP0000, in that way i was not in need to activate them again.

I tried with some smaller values, but at the end of the spline with 0.4 it was still wobbling a little bit, thats why i had to use 0.5 as a minimum.
Fortunally the client saw the 0.5 switch for directions and told me its even better then before, because now you have an better understanding of changing directions. So all in all the dmaping method would have been implemented, even if the SplineController didnt wobble around Wink

have a nice day too and keep on with your wonderful work
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_
  Keeping a fixed spline length jh092 3 16 02-21-2024, 06:25 AM
Last Post: Primrose44
  How could I get position in spline from "From" value in BuildRasterizedPath? Chanon 1 8 02-12-2024, 09:54 PM
Last Post: _Aka_

Forum Jump: