- Home /
Best place to calculate transofrmation matrix
So I have a transformation matrix that I recalculate once every update to figure out where to place a bunch of items in the world that should all move with another object, let's call it "A".
I deliberately don't want those objects to be a child of "A".
As of now, the calculation of the transform matrix is done in a Update() Function (not "A"s to be precise, but I don't think that makes a difference, does it??). And so are the position calculations of the items (each done in their own Update() Function). In those calculations, I multiply the original position of each item with the transformation matrix. I am not sure in what order the Update Functions are called, but is there a way to make sure, the calculation of the transform matrix is done before the calculation of the items?
Thanks for anybodys help!
Answer by Maverick283 · Oct 31, 2018 at 01:32 PM
Too fast to ask that question on here.
Anyways, for those who need to know as well and because I don't want to see a screenshot of this on r/programmerHumor, here is the approach I use that seems to be working fine:
The order in which the update functions are called is arbitrary, yet if specified you can actually make update functions be called before others.
So I put the matrix calculation in an extra GameObject and made sure this will be updated before the items.
To change the update order, go to Edit > Project Settings > Script Execution Order.
If anybody has a better approach I'd be happy to hear it though!
Your answer
