Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connections during speed change
#9
(04-05-2019, 12:04 PM)talentplace Wrote: Curvy is the best plugin i worked with! Good job!
Thanks a lot, I am very happy to read this.

If I had to guess what happened based on what you said, I would say that it might be an issue related to the controller's position being stored as a float. Like you might already know, floats can't represent every possible number, so there are some numbers that are mathematically different, but are the same in the eyes of floats. So with floats, you can end up having a + b - a > b, which is mathematically false. If you want to learn more about this, you can start here: https://stackoverflow.com/questions/753948/why-is-floating-point-arithmetic-in-c-sharp-imprecise

So when having very big segments, and a controller that moves very slowly on them, the code that handles connections can end up with weird situations like the one described above. I have another user which send me a reproduction case few days ago (also having very long splines, and very slow objects). Based on it, i will enhance the connections handling code for an upcoming release.
For future references, here are workarounds to those kind of situation:
  • Avoid having very long segments. The subdivide tool will be helpful.
  • Avoid having very long splines. This should not be necessary if previous workaround works. TheĀ split tool will be helpful.
  • Use Relative in both Position Mode and Move Mode. Due to the nature of float values, the more you get further from 0 the less floats are precise. So to reduce the issue, make the controller work with positions between 0 and. This will mean that when switching between two splines with different lengths, you will need to modify the Speed accordingly, to keep a constant absolute speed. Spline controller has events that you can listen to, like OnEndReached and OnControlPointReached, to detect a change in spline and update the speed accordingly.
  • Use the same value in both Position Mode and Move Mode. This avoids the controller to do some conversion operations on the position value.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
Connections during speed change - by 3583Bytes - 03-24-2019, 02:50 PM
RE: Connections during speed change - by _Aka_ - 03-24-2019, 03:02 PM
RE: Connections during speed change - by _Aka_ - 04-05-2019, 10:44 AM
RE: Connections during speed change - by _Aka_ - 04-05-2019, 01:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connections Problem Juton 3 16 03-06-2024, 10:41 AM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Are connections pooled? Lupos 1 3 05-09-2023, 09:18 AM
Last Post: _Aka_
  How to merge intersecting meshes at spline connections? Reign_of_Light 2 6 03-20-2023, 08:36 AM
Last Post: Reign_of_Light

Forum Jump: