leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
275 stars 52 forks source link

[Question] Translate X/Y/Z Direction is not only for determine the direction ? #752

Open adfriz opened 2 years ago

adfriz commented 2 years ago

When experimenting a formula i found that defining the translate XYZ direction command other than 1 or -1 is accepted, when i write translatexdirection = 0.5, 0, 0 its not only tell the object to move to positive x axis its also read it like move that object on positive x axis for 0.5 meter.

I dont know is this a bug or undocumented feature, also i havent test the rotate xyz direction command is behave the same like that.

I though the translate xyz direction only for determine the function direction either 1 for positive and -1 for negative.

leezer3 commented 2 years ago

It's almost certainly right, but I can't test properly until next week or so. All the rotate functions will behave the same way.

The angle and vector are converted into a rotation matrix, which is a relatively fundamental mathematical operation. Using a non directional vector (e.g. one whose components are not all either zero or one) will produce this sort of thing https://en.m.wikipedia.org/wiki/Rotation_matrix