Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to create a moving train that slows and stops at stations
#1
Firstly thank you for such a great and robust asset!

I must admit that I feel a bit daunted attempting to take the great work you have done here and apply it.
My team and I are creating a wild west themed game and we bought Curvy in order to create our train tracks and train system.

I need help doing a few things:

1.) Creating the train tracks (which as I understand it will also be the path).  From the looks of it there is not a way to provide an existing model and have Curvy use that.  Instead you create a Lathe type outline that is then extruded.  I have been picking apart the example scene with the train but this still confuses me.  How can I create a track that is old west themed graphically?  Do I need a new material that is Lathe-able?

2.) I found the controls for the speed of the train and for creating and attaching new train cars but I cannot seem to find a way to create a "speed system".  Obviously we would like the train to start out moving at full speed, then when it approaches a station play the sounds, slow the train and its animations and eventually stop at the station, wait, then start back up again.  Is this sort of thing possible?  How would I go about doing that?

I am happy to research and tinker I just think I need a push in the right direction; get me on the right track you could say Wink

Any and all help is greatly appreciated!

Cheers~
Reply
#2
(08-16-2018, 03:13 PM)Novian Wrote: Firstly thank you for such a great and robust asset!
Thank you.

(08-16-2018, 03:13 PM)Novian Wrote: From the looks of it there is not a way to provide an existing model and have Curvy use that.
This is not the case. If you take a look at scene 12_Train, and search for the game object named Create GO (Sleepers), you can see how this module is used in the Curvy Generator to replicate an existing model along a path.

(08-16-2018, 03:13 PM)Novian Wrote: I have been picking apart the example scene with the train but this still confuses me.
The tracks in the example scenes are made of both an extruded mesh, and objects placed along that mesh. 

(08-16-2018, 03:13 PM)Novian Wrote: How can I create a track that is old west themed graphically?  Do I need a new material that is Lathe-able?
You can use whatever material you want. You can use the Meta CG Options module to precisely control the materials and UV coordinates on each control point of your section. This is done in scene 26_CGExtrusionExtendedUV.

(08-16-2018, 03:13 PM)Novian Wrote: 2.) I found the controls for the speed of the train and for creating and attaching new train cars but I cannot seem to find a way to create a "speed system".  Obviously we would like the train to start out moving at full speed, then when it approaches a station play the sounds, slow the train and its animations and eventually stop at the station, wait, then start back up again.  Is this sort of thing possible?  How would I go about doing that?

The Spline Controller component has two properties that you can use: Speed and Position. So you can either set the position at each frame, or set the speed and let Curvy update the position. Position can be either a relative value (from 0 to 1) or an absolute one (in world units) depending on Position Mode. Same thing with Speed and Move Mode.


Hope this helps. Please keep in mind that for each component, you have an question mark at the top right corner of the inspector that will open a help page about that component.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
@_Aka_ Thanks very much! I will be looking into this more this evening. I appreciate your help. Smile
Reply
#4
Thanks very much for the help, I've made some good progress.  Having a new issue that perhaps you can help me with?  I need to create a train that has 10 cars.  I have 2 so far but when I try to add a third I am having trouble getting the new car to be positioned correctly.  When I first create it (duplicating from the car in front of it) I can set the Position no problem.  After 1 time running the game the position is off (too large of a gap).  So I go to adjust it and now the value is constantly clamping back to the "gap" value.  I am unable to change it.  Any advice?  Thanks!

See attached image for ref.  If I set it to any value other than the 941.269 shown it instantly snaps back to that value.


Attached Files Image(s)
   
Reply
#5
Hi,
In your message, I distinguish two different issues:
1- The gap appearing between cars: This is something that naturally happens with time due to consecutive operation on floats. There are different ways to try to reduce the issue. One that is already coded can be found in TrainCarManager.LateUpdate(), TrainCarManager being the script used in the scene 12_Train where it manages a train with multiple cars in it. I believe that by following that example, you can fix your issue.
Also, knowing that floats are the most precise between 0 and 1, try using Relative Position Mode and Move Mode, and see if it helps.
2- The impossibility to set a value to the position: I don't have an explanation for this. Are you sure you don't have some code setting the Position value each frame?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
(09-07-2018, 04:24 PM)_Aka_ Wrote: Hi,
In your message, I distinguish two different issues:
1- The gap appearing between cars: This is something that naturally happens with time due to consecutive operation on floats. There are different ways to try to reduce the issue. One that is already coded can be found in TrainCarManager.LateUpdate(), TrainCarManager being the script used in the scene 12_Train where it manages a train with multiple cars in it. I believe that by following that example, you can fix your issue.
Also, knowing that floats are the most precise between 0 and 1, try using Relative Position Mode and Move Mode, and see if it helps.
2- The impossibility to set a value to the position: I don't have an explanation for this. Are you sure you don't have some code setting the Position value each frame?

Thanks very much for the quick response.  1.) I will look into this but each of my "cars' in my train are already using the TrainCarManager script; including TrainCarA (which is the engine).  My obj hierarchy is: Train (with Train Manager Script applied), then its children are TrainCarA-F (each with the TrainCarManager script applied).

2.) I am using no additional scripts that affect the Train at all.  Just base Curvy scripts using the 12_Train scene as an example.

Any insight would be most appreciated!  Thanks!

An additional issue seems to be that only the engine (TrainCarA) is moving from the CP000 to CP0001 and then snapping back to CP0000.  It remains in this infinite loop while the other cars travel along the path correctly (so far, I have to watch them carefully).  Has anyone else had this issue?  See attached image for reference.


Attached Files Image(s)
   
Reply
#7
I can't think of any explanation for your issues. If you send me a scene/project reproducing the issue I will take a look at it.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#8
Much obliged in particular! I will investigate this more tonight. I value your assistance. Grin
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Curvy to create splines from 3D models Sergei543071 1 108 08-07-2018, 02:34 PM
Last Post: _Aka_
  Moving spline controller with parent game object jvalenzuela 7 710 06-02-2018, 10:44 PM
Last Post: _Aka_
  Path Controller GameObject parent / attach to another to another Moving GameObject. chiako3D 4 733 04-24-2018, 06:47 AM
Last Post: chiako3D
  2D Docking to a moving target, (landing direction matters!) nomadigi 1 296 04-12-2018, 10:06 AM
Last Post: _Aka_

Forum Jump: