Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find a point a distance ahead on the spline?
#2
Hi,

maybe you didn't post the whole code involved, but what I see makes no sense. tfAtlastPoint seems to be unused and distBetweenPoints doesn't do what you expect because you're calculating the distance between a world position and a relative value (0..1).

The question is how do you want your collectibles to be placed? Equal F distance? Equal world unit distance?

Here's a pseudocode:

Code:
for (int i=0;i<31;i++)
{
    var myNewGameObject=new GameObject(...);
    myNewGameObject.position=SplineGroup.Interpolate(i/30); // <= this will be equal F
    myNewgameObject.position=SplineGroup.Interpolate(SplineGroup.DistanceToTF((SplineGroup.Length/30)*i)); <= this will be equal distance
}
Reply


Messages In This Thread

Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting Distance from a World Point zorksox 3 5 04-16-2024, 07:30 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: