08-07-2018, 11:17 PM
I'm trying to create a train track with connections that only allow certain ways so that the train doesn't bend like 130 degrees to follow a path even when traveling backwards, just like you've done in your connection/space example. On top of that i'd like to create logic for switching tracks. I'm having some trouble with your UI, i'm not sure what things mean with all the checkboxes. I couldn't find any documentation/videos on it either.
I'm able to get a few things working except for this:
As the train travels up from the bottom of the screen i'd like it to continue along the same track. Currently it jumps to the other track and furthermore it jumps to the other end as you can see in the image, and i'm not sure why because that node doesn't have a connection.
Here is my code:
I believe I can achieve this using your directional based UI instead of writing further code and complicating things. But I haven't been able to yet.
Looking for any help. Thank you.
I'm able to get a few things working except for this:
As the train travels up from the bottom of the screen i'd like it to continue along the same track. Currently it jumps to the other track and furthermore it jumps to the other end as you can see in the image, and i'm not sure why because that node doesn't have a connection.
Here is my code:
Code:
public class TrainConnectionDecider : ConnectedControlPointsSelector
{
public override CurvySplineSegment SelectConnectedControlPoint(SplineController caller, CurvyConnection connection, CurvySplineSegment currentControlPoint)
{
MDJunctionControl jc = currentControlPoint.GetMetadata<MDJunctionControl>();
if (jc && jc.UseJunction != false)
{
return connection.ControlPoints[connection.ControlPoints.Count-1];
}
return connection.ControlPoints[0];
}
}
I believe I can achieve this using your directional based UI instead of writing further code and complicating things. But I haven't been able to yet.
Looking for any help. Thank you.