internal void Create(PoleDictionary Poles, Vector3 WorldPosition, Transformation RailTransformation, Vector2 Direction, double planar, double updown, double StartingDistance, double EndingDistance) { double dz = StartingDistance / Interval; dz -= Math.Floor(dz + 0.5); if (dz >= -0.01 & dz <= 0.01) { if (Mode == 0) { if (Location <= 0.0) { Poles[0][Type].CreateObject(WorldPosition, RailTransformation, Transformation.NullTransformation, StartingDistance, EndingDistance, StartingDistance); } else { UnifiedObject Pole = Poles[0][Type].Mirror(); Pole.CreateObject(WorldPosition, RailTransformation, Transformation.NullTransformation, StartingDistance, EndingDistance, StartingDistance); } } else { int m = Mode; double dx = -Location * 3.8; double wa = Math.Atan2(Direction.Y, Direction.X) - planar; Vector3 w = new Vector3(Math.Cos(wa), Math.Tan(updown), Math.Sin(wa)); w.Normalize(); double sx = Direction.Y; double sy = 0.0; double sz = -Direction.X; Vector3 wpos = WorldPosition + new Vector3(sx * dx + w.X * dz, sy * dx + w.Y * dz, sz * dx + w.Z * dz); int type = Type; Poles[m][type].CreateObject(wpos, RailTransformation, Transformation.NullTransformation, StartingDistance, EndingDistance, StartingDistance); } } }
internal void Create(Vector3 wpos, Transformation RailTransformation, double StartingDistance, double EndingDistance, double Brightness, ObjectDictionary Beacon) { UnifiedObject obj = null; if (BeaconStructureIndex == -2) { switch (Type) { case 0: obj = CompatibilityObjects.TransponderS; break; case 1: obj = CompatibilityObjects.TransponderSN; break; case 2: obj = CompatibilityObjects.TransponderFalseStart; break; case 3: obj = CompatibilityObjects.TransponderPOrigin; break; case 4: obj = CompatibilityObjects.TransponderPStop; break; } } else { int b = BeaconStructureIndex; if (b >= 0 & Beacon.ContainsKey(b)) { obj = Beacon[b]; } } if (obj != null) { double dx = Position.X; double dy = Position.Y; double dz = TrackPosition - StartingDistance; wpos += dx * RailTransformation.X + dy * RailTransformation.Y + dz * RailTransformation.Z; double tpos = TrackPosition; if (BeaconStructureIndex == -2) { obj.CreateObject(wpos, RailTransformation, new Transformation(Yaw, Pitch, Roll), -1, StartingDistance, EndingDistance, tpos, Brightness); } else { obj.CreateObject(wpos, RailTransformation, new Transformation(Yaw, Pitch, Roll), StartingDistance, EndingDistance, tpos); } } }
internal void Create(Vector3 wpos, Transformation RailTransformation, double StartingDistance, double EndingDistance, ObjectDictionary Beacon) { UnifiedObject obj = null; if (Beacon.ContainsKey(BeaconStructureIndex)) { obj = Beacon[BeaconStructureIndex]; } if (obj != null) { double dx = Position.X; double dy = Position.Y; double dz = TrackPosition - StartingDistance; wpos += dx * RailTransformation.X + dy * RailTransformation.Y + dz * RailTransformation.Z; double tpos = TrackPosition; obj.CreateObject(wpos, RailTransformation, new Transformation(Yaw, Pitch, Roll), StartingDistance, EndingDistance, tpos); } }
public void Create(PoleDictionary poles, Vector3 worldPos, Transform railTransform, Vector2 direction, float planar, float updown, float startingDistance, float endingDistance) { if (!Exists) { return; } float dz = startingDistance / Interval; dz -= Godot.Mathf.Floor(dz + 0.5f); if (dz >= -0.01 & dz <= 0.01) { if (Mode == 0) { if (Location <= 0.0) { poles[0][Type].CreateObject(worldPos, railTransform, startingDistance, endingDistance, startingDistance); } else { UnifiedObject Pole = poles[0][Type].Mirror(); Pole.CreateObject(worldPos, railTransform, startingDistance, endingDistance, startingDistance); } } else { int m = Mode; float dx = -Location * 3.8f; float wa = Godot.Mathf.Atan2(direction.y, direction.x) - planar; Vector3 w = new Vector3(Godot.Mathf.Cos(wa), Godot.Mathf.Tan(updown), Godot.Mathf.Sin(wa)); w = w.Normalized(); float sx = direction.y; float sy = 0.0f; float sz = -direction.x; Vector3 wpos = worldPos + new Vector3(sx * dx + w.x * dz, sy * dx + w.y * dz, sz * dx + w.z * dz); int type = Type; poles[m][type].CreateObject(wpos, railTransform, startingDistance, endingDistance, startingDistance); } } }
/// <summary>Creates the object within the game world</summary> public override void Create(Vector3 wpos, Transformation railTransformation, Transformation localTransformation, int sectionIndex, double startingDistance, double endingDistance, double trackPosition, double brightness) { Object.CreateObject(wpos, railTransformation, localTransformation, sectionIndex, startingDistance, endingDistance, trackPosition, 1.0); }