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 helps immensely. Thank you.
Available for freelance work—feel free to reach out.
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 helps immensely. Thank you.
Available for freelance work—feel free to reach out.
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 helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Question about Timeline support GhuaGhua 3 5 05-21-2024, 01:33 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 9 03-28-2024, 10:08 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  How could I get position in spline from "From" value in BuildRasterizedPath? Chanon 1 8 02-12-2024, 09:54 PM
Last Post: _Aka_

Forum Jump: