Multiplying matrixes for child objects

General discussion about Train Simulator, your thoughts, questions, news and views!

Moderator: Moderators

Locked
deltic009
Very Active Forum Member
Posts: 4017
Joined: Fri Nov 27, 2009 1:06 am

Multiplying matrixes for child objects

Post by deltic009 »

So.......

I have my decal how I want it in the sim, with the exception of needing to scale it a bit and rotate it through 90 degrees too.

So for the scaling matrix I have:
[2.25 0 0]
[0 2.25 0]
[0 0 1]

The rotation matrix I require is for a 90 degree rotation clockwise, which is:
[0 0 1]
[0 1 0]
[-1 0 0]

However, when i multiply them together and input my resulting matrix to the .bin file, I lose scaling in one axis but the object rotates exactly how I desire. The result matrix I have (which may of course be totally wrong) is:
[0 0 0]
[0 2.25 0]
[-1 0 0]

Please, could someone help rescue me from trig calculations and insanity.

Thank you.
Matthew Wilson, development team at Vulcan Productions

http://www.vulcanproductions.co.uk
https://www.facebook.com/VulcanFoundry/
User avatar
JLD95
Well Established Forum Member
Posts: 623
Joined: Sun Jan 22, 2012 12:06 pm
Location: Pontoise near Paris, FR
Contact:

Re: Multiplying matrixes for child objects

Post by JLD95 »

Hi

Matrix result is:
[0 0 2.25
0 2.25 0
- 1 0 0]
Jean-Luc - French user
PC: MSI Z87-G45 - Core i5 4670K - 16Go RAM - Win7 64bits - KFA2 GTX 1080 ExOC - SSD system Samsung 840 240Go + SSD Steam SanDisk UltraII 480Go - Display 27'' 1920x1080
deltic009
Very Active Forum Member
Posts: 4017
Joined: Fri Nov 27, 2009 1:06 am

Re: Multiplying matrixes for child objects

Post by deltic009 »

JLD95 wrote:Hi

Matrix result is:
[0 0 2.25
0 2.25 0
- 1 0 0]
Okay, thanks for your help. If you know any easy tutorials or can explain easily where I went wrong that would be great. As always, once I know I know, but when I don't know I get very cross.
Matthew Wilson, development team at Vulcan Productions

http://www.vulcanproductions.co.uk
https://www.facebook.com/VulcanFoundry/
User avatar
Kernow2
Well Established Forum Member
Posts: 874
Joined: Tue Nov 30, 2004 7:50 pm
Location: Deepest Darkest Devon

Re: Multiplying matrixes for child objects

Post by Kernow2 »

This has worked for me on the very few times I've investigated matrices..
http://www.mathsisfun.com/algebra/matri ... lator.html
Just tried your example it it worked ok!
Why not give it a try?
Regards,
Kernow2/Graham
scefhwil
Well Established Forum Member
Posts: 907
Joined: Tue Dec 04, 2001 12:00 am
Location: Bristol, England

Re: Multiplying matrixes for child objects

Post by scefhwil »

Interesting thread! Have pondered about how to do this with child objects but never got around to it. So, how does the resultant 3x3 matrix get translated into the 4x4 in the blueprint?
deltic009
Very Active Forum Member
Posts: 4017
Joined: Fri Nov 27, 2009 1:06 am

Re: Multiplying matrixes for child objects

Post by deltic009 »

scefhwil wrote:Interesting thread! Have pondered about how to do this with child objects but never got around to it. So, how does the resultant 3x3 matrix get translated into the 4x4 in the blueprint?
The 3x3 is just numbers that go into positions 1,2,3,5,6,7,9,10,11 in the 4x4 matrix. The 3x3 is in the top left corner of the 4x4.
Matthew Wilson, development team at Vulcan Productions

http://www.vulcanproductions.co.uk
https://www.facebook.com/VulcanFoundry/
scefhwil
Well Established Forum Member
Posts: 907
Joined: Tue Dec 04, 2001 12:00 am
Location: Bristol, England

Re: Multiplying matrixes for child objects

Post by scefhwil »

Quite simple then. Thanks.
Locked

Return to “[TS] General Discussion”