Skip to main content
1 of 3
Steven
  • 3.1k
  • 18
  • 24

I think you want two matrices: one a local-to-parent transforn and one a cached worldspace matrix. You also want a dirty flag. When an object moved in world space the local to parent matrix is updated and the dirty flag is set. All of the children then have their dirty flags set. Any request for an entities world matrix must first check the dirty flag. If set travel up to the first ancestor that is not dirty and recalculate each descendants world space matrix, clearing their dirty flag, back to the original entity. Then return the new world matrix. This avoids recalculating matrices of top level objects that have not moved or children who are part of a heirarchy that is static this frame.

Steven
  • 3.1k
  • 18
  • 24