Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Orient Spline to Object
#1
Hi,

I am trying to get a physics based train to travel along a spline made up of separate splines on prefabs. Instead of messing with the physics on the train, I am leaving the physics alone and moving the world under the train. I can get the world to move each segment of track(each a separate spline), but I can't get the world to rotate to line the rails(spline) with the train.
What I have so far,
Each frame
- The train moves forward via physics.
- After the train has finished moving I move each segment(these are children of a world object) the same movement the train has made that frame.
- I then reset the train back to the origin.

The train follows the splines perfectly, but I now need the parent world object to rotate to align the spline (nearest spline point on the nearest segment) to the train which is always pointing forward in the world.

Any ideas would be really helpful

Thanks
Dan
Reply
#2
Hi,
I am not sure to understand fully the situation, but I got enough of it to think about common mistakes that could be the reason behind your issue. If you did not make those mistakes in your project, please post here again and I will ask you specific questions to understand your issue properly.
Here are the common mistakes:
  • Not setting the correct value to the "Use Global Space" property in your Input Spline Path module
  • When using API methods that work in the spline's local space, like the CurvySpline.GetTangent method, not converting the result to the global space.
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


Possibly Related Threads…
Thread Author Replies Views Last Post
  animating points on a spline Antonio 11 18 09-17-2023, 09:55 AM
Last Post: _Aka_
  Getting object on spline Position when Spline has coordinates larger than 2000 velikizlivuk 5 8 09-05-2023, 01:01 PM
Last Post: velikizlivuk
  Spline.Length not updated unless I add a point to spline (or modify it) first. _RicO 3 6 08-26-2023, 08:41 AM
Last Post: _Aka_
  Raise spline events during edit mode arcadeperfect 3 6 08-24-2023, 08:38 AM
Last Post: _Aka_

Forum Jump: