Seeing all the problems everywhere caused by the Microbe Nodes being nested (instead of following the assumption that was followed for a year that each game object has the Translation equal to its position in the world), I think the microbe colony design needs to be changed, it’s so problematic regarding that pure design. And probably accessing the GlobalTransform requires extra matrix multiplications to compute the position, which otherwise would be a simple Vector3 copy, which can’t be that great performance-wise.
So here’s my better design:
- Only the colony leader is a Microbe object that is attached to the scene properly (and tagged as a microbe)
- The other cells in a colony use the preview only Microbe class instances as child nodes, or optionally the colony leader also manages creating their visuals for them. It’ll be a bit tricky to toggle a cell on unbind / bind between being a full cell or a display-only one.
- The physics is handled by the colony leader creating hex collisions for the colony members as well. Sub shape indexes can be used to detect which individual cell was hit (if we don’t want to have colony wide single health bar.
Or maybe in the end it would be simpler to do this:
- Disable physics on other colony members (or find another fix for Fix collision / physics issues (maybe causes ghost drift) between colony members · Issue #2308 · Revolutionary-Games/Thrive · GitHub)
- Remove the microbe tag from the child Microbe nodes, and then add it back when detaching from a colony. This needs special care as otherwise the cells become ghosts, untergettable by the AI and the hover cursor.
- But otherwise keep the current design
Here’s a meta issue about this:
Once the design is changed, most uses of
GlobalTransform.origin should be safe to remove.