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?
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
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
  Create Game Object Renaming Options rickgplus 1 925 09-23-2025, 09:33 AM
Last Post: _Aka_
  Create Mesh Node, Make Static Options rickgplus 1 1,821 01-23-2025, 10:12 AM
Last Post: _Aka_
  Moving Platform Kokoriko49 8 4,290 09-23-2024, 09:20 AM
Last Post: _Aka_
  Train-Wagon Wheels stathias 3 2,226 08-30-2024, 12:46 PM
Last Post: stathias

Forum Jump: