Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question about the local position
#1
Question 
Hi,
I am using your asset namded curvy spline which is downloaded from assetstore, the version is 7.1.5, I think this is a amazing asset!
But I recently find that the local position of controll point I have setted in my script is different, so, could you tell me where the issue come from?
Here is the my script example and detail:
I use the cury spline and made into a prefab , then I use my poolmanager to load the prefab to draw the line by the controll point;
for example  I set to :
                float x=-104.008, y=7.14151 ;
vector3 vec3;
CurvySpline curvySpline;

                vec3.Set(x, roadlineHeight, y);
                curvySpline.Add(vec3);//local positon;

Then when I check the controll point ,I find the local position is not original xy ,but a little different, result is x=-104.658  y=7.156 for example,
So, is there any wrong in my code or setting? I send you the screen shot of my prefab and my prefab, maybe you can help me to check it?

Thanks!


Attached Files
.zip   NewMapline2.zip (Size: 4.4 KB / Downloads: 0)
.zip   sreenshots.zip (Size: 635.85 KB / Downloads: 0)
Reply
#2
Hi
The pictures you send me via email is of .8C694461 extension. I couldn't open them.
The perfab you send is missing a script, I guess the one which adds the control points. Can you please send me a simple reproduction case so I can debug and see why the coordinates change?
Thanks
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 for your reply, the missing script is not the script to add the control point , the adding controll point is controlled by another script,
for example:
float x=-104.008, y=7.14151 ;
vector3 vec3;
CurvySpline curvySpline;
GameObject MapLines = DarkTonic.CoreGameKit.PoolBoss.Spawn("NewMapline", parent.transform.position, parent.transform.rotation, this.transform).gameObject;

MapLines.transform.localPosition = parent.transform.localPosition;

MapLines.transform.localRotation = parent.transform.localRotation;



CurvySpline curvySpline = MapLines.transform.Find("Input Spline Path/Input Spline Path_1_Spline").gameObject.GetComponent<CurvySpline>();
curvySpline.Clear();


int c = newMapLine.GstPoint.Count;
for (int j = 0; j < c; ++j)
{


vec3.Set(x, roadlineHeight, y);
curvySpline.Add(vec3);
}
Reply
#4
Try adding a log of vec3 after you call the vec3.Set method. Maybe it is the one that changes the coordinates, and not Curvy.

This code uses classes that are not available to me (PoolBoss), so I can't run it. What I suggest to you is to create a new script, to use in a new scene, that does only the vec3 setting and the control point adding. If you managed to reproduce the issue with this simple setup, then you have a reproduction case to send me (scene and scripts). If the issue does not appear, then you know the problem comes from the difference between the real case and the simple reproduction case. You can then iteratively make the reproduction case more and more complex until it becomes the same as the real case. In that process, you will find what line of the code exactly creates the issue.
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
For future reference: the original poster found the cause behind the issue, and it was not due to Curvy
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
  Noob Question Wyldhunt 5 170 09-04-2021, 06:53 PM
Last Post: _Aka_
  get world vector3 from absolute position on spline hawken 2 423 06-08-2021, 12:28 PM
Last Post: hawken
  Create a path with Curvy from a "position" animation with several keyframes mc_deimon 1 438 05-20-2021, 10:04 AM
Last Post: _Aka_
  Get position on spline relative to world position Mos Def 9 1,936 05-20-2021, 08:32 AM
Last Post: _Aka_

Forum Jump: