Elvas Tower: Derailed looking bogies - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Derailed looking bogies Rate Topic: -----

#11 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 09 May 2014 - 05:15 PM

Thanks for confirming the bug and reporting it at Open Rails Tracker, Chris!

I know now the rigid bogies only can be seen with tracks, which lie on an integer altitude value such as:
...
1 m
2 m
3 m

...
and so on.

For example a track position at 1 meter with an entry in the world file like this:

TrackObj (
UiD ( 5 )
SectionIdx ( 87 )
Elevation ( 0 )
CollideFlags ( 527 )
FileName ( A1t45dYardCrvRgt.s )
StaticFlags ( 00200180 )
Position ( -462.038 1 648.825 )
QDirection ( 0 -1 0 1.26759e-006 )
VDbId ( 4294967294 )

)

Best regards
Jonas

#12 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 10 May 2014 - 06:19 AM

Because vehicles in MSTS/OR of course not actually go on the track shapes itself, but on the vectors in the *.tdb file, I've test to change the corresponding vector values ​​in the "TrVectorSections" from "1" to "1.001". After doing this the rigid bogies were gone.

Can someone tell me in which of the source code files of OpenRails the bogies are controlled?

#13 User is online   cjakeman 

  • Vice President
  • PipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 2,868
  • Joined: 03-May 11
  • Gender:Male
  • Location:Peterborough, UK
  • Simulator:Open Rails
  • Country:

Posted 10 May 2014 - 11:57 PM

View Postjonas, on 10 May 2014 - 06:19 AM, said:

Can someone tell me in which of the source code files of OpenRails the bogies are controlled?

Yes, I would like to know how this works.

I had a look and couldn't figure it out.

#14 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,491
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 12 May 2014 - 02:41 AM

They're done in MSTSWagonViewer.cs IIRC (not at my PC) which uses the Traveller to computer their rotations during an update. It uses a utility method (again, IIRC) to convert two nearby locations in the Traveller in to direction angle and applies that rotation to a matrix.

#15 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 12 May 2014 - 06:01 AM

I have now found out that it is in the file "TrainCar.cs" at line 1030 (OR version 0.0.5245.26810 (2014-05-12 14:53:40Z)). There is an if-clause, which responds to the special case that the bogie has the vector (0,0,0). This should force the angle value of the bogie to cosine 1, which in turn causes the rigid bogies.

                 if ( fwd1.X != 0 && fwd1.Y != 0 && fwd1.Z != 0)//fwd1 can be (0, 0, 0), force cos to be 1
                 {
                     fwd1.Normalize ();
                     p.Cos = Vector3.Dot (FWD, FWD1 );
                 }
                 otherwise p.Cos = 1;

According to the comment in the if-line the case should be treated, that all 3 vector values ​are simultaneously 0. But in fact, it is sufficient when one(!) Value is at 0 already. And that is the problem here I think.

For tracks at a interger height, the Y-value is 0, as I could see while debugging OR. The if-clause engages in this case and set the cosine to 1 and the bogies gets rigid.

My suggestion is therefore to change the if-clause in:

                if (!(fwd1.X == 0 && fwd1.Y == 0 && fwd1.Z == 0))//fwd1 can be (0, 0, 0), force cos to be 1

In this way, it works only if all 3 vector values are simultaneously 0.

Since then I have made this change, the rigid bogies are gone while debugging.

I hope it helps you fix the bug.

Best Regards
Jonas

#16 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,491
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 12 May 2014 - 06:46 AM

View Postjonas, on 12 May 2014 - 06:01 AM, said:

                 if ( fwd1.X != 0 && fwd1.Y != 0 && fwd1.Z != 0)//fwd1 can be (0, 0, 0), force cos to be 1


My suggestion is therefore to change the if-clause in:

                if (!(fwd1.X == 0 && fwd1.Y == 0 && fwd1.Z == 0))//fwd1 can be (0, 0, 0), force cos to be 1



Thanks and well done! The slightly simpler way is to replace the "&&"s with "||"s - the code should be checking that any of them are non-zero (which is the inverse of all of them are zero).

#17 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 12 May 2014 - 07:55 AM

Thank you James, my pleasure...ahh ok, I read it the other way around.

#18 User is online   cjakeman 

  • Vice President
  • PipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 2,868
  • Joined: 03-May 11
  • Gender:Male
  • Location:Peterborough, UK
  • Simulator:Open Rails
  • Country:

Posted 12 May 2014 - 10:34 PM

View PostJames Ross, on 12 May 2014 - 06:46 AM, said:

The slightly simpler way is to replace the "&&"s with "||"s - the code should be checking that any of them are non-zero (which is the inverse of all of them are zero).

I'll commit it tonight and update the Bug Tracker.

#19 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 13 May 2014 - 03:05 PM

Since OR version X2233, the error seems to be resolved. The rearranged code and the if-clause are a clear statement now!

          if (fwd1.X == 0 && fwd1.Y == 0 && fwd1.Z == 0)
                {
                    p.Cos = 1;
                }
                else
                {
                    fwd1.Normalize();
                    p.Cos = Vector3.Dot(fwd, fwd1);
                }


Since the new version all bogies are running fine on tracks of every height level!

Thank you and best regards!
Jonas

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users