mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 07:29:20 +02:00
feat(editor): switch drive placed with a switch leans with the grade and the cant of the track at the points, raised as the simulation raises a canted track
This commit is contained in:
@@ -4747,6 +4747,14 @@ bool editor_mode::place_switch_drive(TTrack &Switch)
|
||||
item.yaw = yaw < 0.0 ? yaw + 360.0 : yaw;
|
||||
item.described = true;
|
||||
item.track = Switch.name();
|
||||
{
|
||||
auto const along{control != glm::dvec3{} ? control : main.points[segment_data::point::end] - start};
|
||||
auto const run{glm::length(plan_of(along))};
|
||||
auto const roll{static_cast<double>(main.rolls[0])};
|
||||
item.tilt = {run > 1e-9 ? -glm::degrees(std::atan(along.y / run)) : 0.0, roll};
|
||||
if (Global.bRollFix)
|
||||
item.location.y += 0.75 * std::abs(std::sin(glm::radians(roll)));
|
||||
}
|
||||
std::string error;
|
||||
if (place_templates({item}, error) == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user