Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some Questions about useful function I need
#1
Hello, I would like to buy your plugin, but before i buy, I have several requirement for a spline plugin (needed function), And I would like to ask you, If I may, If we can do that with your plugin, and how.

I want these function to be avaible on editor and at runtime:

For the Spline Controller:

1) I would like to set / get the position in the spline depending on a percentage (from 0 to 1), like:
Code:
Vector3 positionInSplineByPercent = m_spline.GetPositionByPercentage(percent);
m_spline.SetPositionByPercentage(percent)

2) From a given position in the world, I would like to get the closest position in the spline (by percentage OR by position), like:
Code:
Vector3 positionInSpline = m_Spline.GetClosestPositionFromAnotherPosition(Vector3 otherPosition);
or:
float percentInSpline = m_Spline.GetClosestPositionPercentFromAnotherPosition(Vector3 otherPosition);

3) When changing the Spline in editor, automaticly adjuste the SplineController on the Spline

4) Set All controls points of the spline on a 2D plane (and chose the axis: X/Y, or X/Z)


Thanks you !
Reply
#2
Hi,
1) To get the TF: SplineController.RelativePosition
    To get the normalized distance: SplineController.AbsolutePosition / SplineController.Spline.Length
    The difference between TF and Distance is explained here: https://curvyeditor.com/documentation/splines/start#units

2) Both are done by a single method: CurvySpline.GetNearestPointTF(Vector3 localPosition, out Vector3 nearestPoint)
   https://api.curvyeditor.com/520/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html#a826c07a945b2ddc06e627369c49bc5a6

3) It is the case

4) Via the API: CurvySpline.MakePlanar methods
   https://api.curvyeditor.com/520/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html#a19213a21e3ae976cdb8715e34236174b
   This method is accessible in the inspector via the Restrict to 2D option
   https://curvyeditor.com/documentation/splines/curvyspline#restrict_to_2d
   Note that Restrict to 2D make the spline planar on the X/Y plane. Right now, there is no plane selector in the inspector. Your message made me notice this lack. I will add a selector in a future version. But until then, I can send you a modified version of Curvy's code that will add said selector in the inspector.
  Also, there is a functionality to project a spline on any collider, including planes:
  https://curvyeditor.com/documentation/toolbar?s[]=project&s[]=camera#camera_project

All of the above is doable both in edit mode and play mode

If you have any other question please let me know.

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
#3
Thanks you for your reply ! I have 2 more question Wink

5 )I just saw you didn't undestand my first question, I will try to reiterate:

I have a float _percent, between 0 and 1.
How can I get a Vector3 position ? (without SplineController, I have just an CurvySpline):

Code:
Vector3 posByPercent = _splineCurvyPlayer.GetWorldPosByPercent(_percent);

Same with rotation, I would like to get the rotation who follow the spline, like that:
Code:
Quaternion rotationForward = _splineCurvyPlayer.GetWorldRotationByPercent(_percent);

6 ) It's less a suggestion this one. With GetNearestPointTF, we can have the float, based on the local Position:
Code:
float nearest = _splineCurvyPlayer.GetNearestPointTF(pos, out closestPosition);

But if pos is not a local position, we have to convert it like that: (not tested):
Code:
Vector3 posRelative = _splineCurvyPlayer.transform.InverseTransformPoint(pos);

float nearest = _splineCurvyPlayer.GetNearestPointTF(posRelative , out closestPosition);

It would be good if we could pass a bool local = true at the function GetNearestPointTF Wink


Thanks you for your amazingn support Smile
Reply
#4
5) methods Interpolate, InterpolateByDistance and GetOrientationFast
https://api.curvyeditor.com/520/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html#a978e66518a7eae520c0af1879733a5c8

6) Thanks for the suggestion. This is something I think of doing but haven't yet took the time to do, since I have to do it everywhere in the API to keep it coherent. Hopefully soon Smile
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
Hello Smile, Again a little Question / suggestion:
We can't go backward by setting the speed to negative with the SplineController.
So as the commentary suggested, I can set the Direction to BackWard... But then my car rotate, and I don't want my object to rotate, I just want to go backward xD

So maybe I can set every Update the RelativePosition to (_splineController.RelativePosition - amountSpeedBackward), but how do you calculate the amountSpeedBackward ?

Or maybe you already have an option for this ?
Thanks Smile
Reply
#6
Ignore Direction is what you look for. You can find its documentation here https://curvyeditor.com/documentation/controllers
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Does Curvy has gameobjects pooling system function? Chanon 7 13 09-07-2023, 12:43 PM
Last Post: _Aka_
  Scene 51 questions lukasynthetic 3 12 06-22-2022, 04:12 AM
Last Post: _Aka_
  Conform function, but applied to different directions at the same time Hartigan27 1 10 02-19-2022, 05:09 PM
Last Post: _Aka_
  Spline editing questions giollord 5 150 12-04-2021, 02:24 PM
Last Post: _Aka_

Forum Jump: