Hi guys, how are u?
I'm having a little “issue” with my current design of the update logic, basically I have a Local Matrix (local pos, like 0 0 0) and a World Matrix (if attached could be 5131 -34 5790), I also have an attachment system, and calculate World Matrix before render, so if a parent moved, will also affect the childs. I first run the Update logic (modifying the local matrix) then after all the updates are done I call BuildMatrix (run through all lists that need a recalc for theirs childs) and then Render using the World Matrix.
My issue, is that sometimes in the Update logic I need the World Matrix (in order to get it, I have to force a BuildMatrix call if something in the chain has changed), and I prefer to avoid it, is there a design pattern for this issue, any idea? I was thinking on create a “cache world matrix” that gets the previous world matrix maybe, but can lead to issues with positions being 1 tick behind, or maybe when I need to use the World Matrix just get the Local Matrix from the root (the first parent) of the list.
Thanks!