Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want SetLocalPositions to update all CPs at once.
#1
Hi.

Currently, I am updating all CPs every frame with the following code.

Code:
for (int i = 0; i < s_SplinePath.ControlPointCount; i++)
{
    s_SplinePath.ControlPointsList[i].SetLocalPosition(s_PositionBuffer[i]);
}

s_PositionBuffer is a Vector3[].
SetLocalPosition() internally calls SetSynchronizationPositionAndRotation() in CurvyConnection.cs, and if Vector3s in s_PositionBuffer have changed, this processing occurs each time.

In order to minimize the processing load, I would like to have a method that can be set all at once as follows.

Code:
s_SplinePath.SetLocalPositions(s_PositionBuffer);

Thanks.
Reply
#2
Hi
SetLocalPosition does a lot of things: updates the Control point's position, dirties the spline, and handles connections synchronisations. Do you need the synchronization part? Otherwise, you can simply set the local position by calling:
s_SplinePath.ControlPointsList[i].transform.localPosition = s_PositionBuffer[i]
Let me know if this solution is enough for you
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
This is exactly the answer I was hoping for.
Synchronization is not necessary, so I will set it up the way you suggested.
Thank you!
Reply
#4
You are welcome
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
  Update - Which folder to delete Marco Schultz 3 8 04-26-2022, 05:00 PM
Last Post: _Aka_
  CurvyConnection Update Overhead wingednosering 10 916 10-13-2021, 05:23 PM
Last Post: _Aka_
  Lots of Allocs in Editor Update (Poor Performance in Editor) TdayMFG 4 3,151 02-06-2020, 10:13 PM
Last Post: _Aka_
  Disable the Update of the CurvySpline UsernameHed 8 6,299 05-29-2019, 01:13 PM
Last Post: _Aka_

Forum Jump: