Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scene 51: Dynamic track between two points
#2
Hi,

Glad you are liking Curvy Splines.

Various points:
  1. When adding the first control point of your spline, using InsertAfter or InsertBefore doesn't make sense, since their are no other control points. Prefer using the Add() method.
  2. When computing targetDirection, you substract two positions, one in local coordinates and the other in world coordinates. That's not good. Use world coordinates for all of them. Meaning:
    Vector3 p = TrackSpline.ControlPointsList.Last().transform.Position;
  3. In the following
    mDir = Vector3.Lerp(mDir, targetDirection, 0.5f);
    Use Vector3.SLerp instead of Lerp. Look for them online to understand why.
  4. About this line:
    Vector3 position = TrackSpline.transform.localToWorldMatrix.MultiplyPoint3x4(p + (mDir * CPStepSize));
    once again, it mixes positions/directions computed using a mix of local and world coordinates. Either compute everyting in local (and then convert to world) or in wold.About the conversion itself, you can use one of these instead, which are less prone to human error: Review your code with all what I said in mind, and you might find what mistakes you made when computing the positions/directions used by your script.

If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply


Messages In This Thread
RE: Scene 51: Dynamic track between two points - by _Aka_ - 08-14-2024, 08:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Any performance 'hacks' for scene with lots of splines rickgplus 1 1,983 03-18-2025, 10:11 PM
Last Post: _Aka_
  Disable rebuild of meshes in dynamic mode Zilk1 3 2,487 05-27-2024, 08:14 AM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 3,235 04-02-2024, 02:24 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 1,956 03-28-2024, 10:08 PM
Last Post: _Aka_

Forum Jump: