Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to create a moving train that slows and stops at stations
#10
Hi,
The TrainManager script, which is just an example script, not something that has the quality needed to be on production, has a Position field. This field is used in the setup method to define the position of all the wagons. This happens in two situations:
  • At the script start
  • When values are modified through the inspector
Other than those two situations, the Position field is not used.

When you modify the field's value via the Animator, nothing will happen. If you want it to be used immediately to override the wagons' positions, then the easiest way to do it (and not the most efficient) is to comment the first line of the LateUpdate method. This will make the setup method run every frame. Overkill, yes, but it works.
For the long term, I advise you to use what you learnt from the example scripts to write your own train manager that will suit perfectly your needs.

Did this help?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
RE: Trying to create a moving train that slows and stops at stations - by _Aka_ - 12-11-2019, 12:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Heart Create beautiful curves ShiroeYamamoto 3 11 03-26-2024, 06:25 PM
Last Post: _Aka_
  Is it possible to create a road texture at runtime? artsung 1 4 01-30-2024, 09:30 AM
Last Post: _Aka_
Wink Train carriage with 2 bogies following a path arcadeperfect 9 27 08-25-2023, 02:56 PM
Last Post: arcadeperfect
  Moving object down or up the spline using gravity velikizlivuk 6 19 07-26-2023, 10:06 PM
Last Post: _Aka_

Forum Jump: