Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Aligning objects from points on spline
#4
(02-19-2021, 07:52 PM)Lupp_ Wrote: If you don't know how to calculate that there's no way I will ever figure it out with my math unskills. Idea Hmm, maybe this is a good feature request for the future. An action that places an object at a fixed, linear distance from an other object on the spline. Sounds good? Big Grin
Sounds good Big Grin I noted the feature request, but it is not on the top of the priority list.

(02-19-2021, 07:52 PM)Lupp_ Wrote: Anyway, to get this approximation info should I check the use cache button in get info action? Or is it something else or can you only do it by code?
GetApproximation is a public method of CurvySpline, so like all other API methods, you should be able to call it through Playmaker or Bolt.
   
I have no idea about how easy or feasable to implement the whole logic I described, I have no experience using for loops and whatnot via PlayMaker

(02-19-2021, 07:52 PM)Lupp_ Wrote: I had a little trouble follow your example, but if you use that method wouldn't the result change a bit every frame? I don't want precision just for the sake of it, but to keep the two anchors at the same position from each other. If the distance changes every frame it will make the movement jittery and that's what I try to avoid.
There are no reasons for the result to change. If you go back to my example, all the input data is:
the spline, the distance D and the point A. As long as none of those change, the result should not change.

(02-19-2021, 07:52 PM)Lupp_ Wrote: Maybe this is what you said and I didn't get it, but how about this idea? On the frame the object spawn you get a center point from the object and align it to the spline as normal. Then from that position you get the closest point on the spline for each of the anchors and align them to the spline. Now every following frames you move these two points a fixed distance on the spline just as you would move a normal setup and then align the parent to the point in the center of them.
Would this keep them a fixed distance from each other, precise enough that the object doesn't jitter? Or am I completely off here?
This is basically the idea of the train example scene as far as I understand. I think it is a simple solution that gives satisfying results, and I am all with simplicity. Keep in mind that through hours or running, errors in floating points computation (in simpler terms, inherent errors related to float operations) will accumulate, so checking that both anchors keep a constant distance between them is important, and correcting that when necessary. This is what is done in the train example scene.
Approximating a linear distance to a non linear distance is a simplification that is not exact in some cases, but if it gives good enough results, then why not
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
Aligning objects from points on spline - by Lupp_ - 02-18-2021, 04:08 PM
RE: Aligning objects from points on spline - by _Aka_ - 02-20-2021, 02:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: