Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to ping-pong a train?
#3
(07-10-2020, 11:34 AM)_Aka_ Wrote: Try having an OnEndReached event listener for the locomotive where you setup all the other carriages accordingly.

Thanks I will try this, how can this be set though for the carriages as in how do I force them to think the end is reached when they haven't? Or is it easier to set their direction to reverse or something when the parent reaches the end?

Just trying, but I am unsure how to check if the event has been invoked in code? I cant do it using the interface and dragging the script on to the events part of the curvyspline module. Sorry this is a bit off topic I am quite new the events!

I have declared:

CurvySplineMoveEvent e_EndEvent = new CurvySplineMoveEvent();

then in Start()

e_EndEvent.AddListener(GetComponentInChildren<SplineController>().OnEndReached);

But it's not happy I think because Addlistener is expecting a UnityEvent not a Curvy one? How would I add the listener and then check it has been invoked?

And lastly how would I set the direction of the child objects to Backward? I have read the documentation but I am not sure exactly how this works, I can see there is a .Set method for <SplineController>().MovementDirection but how would I actually set it to Backward?

Sorry if this is too basic for this forum but I appreciate any help to get me going!
Reply


Messages In This Thread
How to ping-pong a train? - by jamesunity - 07-10-2020, 11:19 AM
RE: How to ping-pong a train? - by _Aka_ - 07-10-2020, 11:34 AM
RE: How to ping-pong a train? - by jamesunity - 07-10-2020, 11:49 AM
RE: How to ping-pong a train? - by _Aka_ - 07-11-2020, 03:05 PM
RE: How to ping-pong a train? - by jamesunity - 07-13-2020, 11:14 AM
RE: How to ping-pong a train? - by _Aka_ - 07-13-2020, 11:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Train carriage with 2 bogies following a path arcadeperfect 9 27 08-25-2023, 02:56 PM
Last Post: arcadeperfect
  Train car orientation on slopes bennidhamma@gmail.com 3 1,027 03-26-2021, 10:30 AM
Last Post: _Aka_
  Player to Train DeadCcell 3 1,211 12-08-2020, 08:07 AM
Last Post: _Aka_
  Train tracks with transparent middle? jh092 4 2,250 07-03-2020, 07:13 PM
Last Post: _Aka_

Forum Jump: