Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting object on spline Position when Spline has coordinates larger than 2000
#1
When Spline is located around world vector3.zero this:
curvySpline.GetNearestPointTF(curvySpline.GetNearestPoint(this.gameObject.transform.position, Space.Self))
does return Relative position correctly (slightly larger than 0).
But, if Spline/Generator is located for instance at:
Vector3 (-2000, 50, -100)
it returns 1 despite the fact that it should be closer to 0.
curvySpline.GetNearestPointTF(curvySpline.GetNearestPoint(this.gameObject.transform.position, Space.World)) - this does the same.
Reply
#2
This is weird. Can you please send me a reproduction case? Also, what version of Curvy Splines do you use?
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
Using CurvySpline 8.7.2 and it is strange. On two separate scenes when spline and object (that attaches to spline on collision) are moved to x:-2000 relative position of contact is 1 and it should be closer to 0. In both cases when Spline and Object are moved closer to 0,0,0 everything works. Let me debug that further, maybe I did something wrong Wink
Reply
#4
UsingĀ 
curvySpline.Flip()
after relative object on Spline position is set, results in this kind of behavior.
Also, converting object position to local space and then doing:

float relativePositionToAttach = curvySpline.GetNearestPointTF(curvySpline.GetNearestPoint(generator.transform.InverseTransformPoint(this.gameObject.transform.position), Space.Self));

is the better way

Everything is fine and dandy.
Reply
#5
Glad to read that.
I see that, having a point A, you first get B, which is the nearest point to A on the spline, then you get TFB, the TF of B. You can simplify this by directly getting TFA, the TF of A. A and B have the same TF.
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
Yeah, getting relative position depends on direction of spline, so flipping it after that results in getting opposite relative position if I got it right.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Bug: Save Generator Outputs still saves outputs if object is disabled curvymesher 1 2 08-30-2024, 09:19 AM
Last Post: _Aka_
  Player move with object mcarman 4 8 07-29-2024, 06:49 PM
Last Post: mcarman
  Nested Spline Volume Spot Instantiation merobbins5 3 6 07-26-2024, 09:58 AM
Last Post: _Aka_
  Left-right movement, and spline follow shihaya 3 8 07-12-2024, 12:50 PM
Last Post: _Aka_

Forum Jump: