Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find a point a distance ahead on the spline?
#3
(06-06-2014, 06:33 PM)'Jake' Wrote: 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
}
I think it was a bit late at night when I posted that... was also editing the code to remove excess stuff that wasn't related to this question. Smile

The final result I'm looking for is that the first collectable is placed a short distance from the start of the spline, then the next is placed between X and Y random distance after the first, then the next is placed another X and Y random distance from the first, and so on. That's the question (or comment) I should have asked last night. Smile


 
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: