RFC: How are you using the transform systems at run-time?

@Adam-Mechtley ,
To give some sense, what I am doing, here is one of my projects that I use transformations.

1. Translating/rotating root-level entities around in the world

So I got lifeforms, which have cells. Each cell is child of lifeform, as standard approach.
I instantiate lifeforms, then generate cells and attach them accordingly, by assigning cell entity to parent entity, using Parent component. Children and other required components are auto generated, by DOTS apis.

2. Positioning objects/hierarchies after instantiating them

I use custom system, for positioning and orientation of lifeforms. Currently iterating through children (cells), to set their local scale and position, in respect to parent (lifeform), when it moves and grows. Technically that should be dealt, by DOTS apis, but at current, it is legacy of my older system, which also involved individual cell scale. I will probably change this behaviour later point. That deals automatically, with attaching cells at specific local position of lifeform.

3. Applying scale to static meshes/colliders

While I currently apply scale to cells, I use

Unity.Physics.BoxCollider* scPtr   = (Unity.Physics.BoxCollider*) physicsCollider.ColliderPtr ;

for dynamic collider of life forms (not individual cells), and for collider scaling.
It isn’t my favorite approach, but it works.

4. Are you making use of components other than Translation, Rotation, Scale/NonUniformScale, and Parent?

I have custm buffer in lifeform entity, with cells entities references and their local positions, rater using children buffer of lifeform parent. This is kind of duplicate, of DOTS child API, but is more for convenience, as I wasn’t sure, if I keep using default DOTS child buffer. For now cells mainly contains information about used shaders properties, along material and transformation.

Also, I have custom position, rotation, scale components for lifeform, which stores position as int. At least until float will be deterministic. These are my prime values I work with, when operating in a world.

5. Are you dynamically changing hierarchies at run-time? If so, to what effect?

I add and remove cells (children) at runtime.

7. Are there things you are not using the transform systems for right now, that you expect or hope it will be able to support?

Can you elaborate please?

8. How easy/hard do you find it to use?

Once grasped, is rather intuitive.
But figuring out, what and how things work, require a bit of reading and searching.
For example children parenting. But documentation shows quite clearly, what and how should be done.

9. Do you find it hard to reason about latency/timing of transform updates during your frame?

I haven’t noticed. At least it is not an issue for me. I relies on my integers for transforms, as primary values. then assign transformation only for rendering, other than collider itself.

10. Anything else?

Not using DOTS Unity Rendering V2.

I was considering using colliders for cells, but I found too much hassle with it. Haven’t figured out, how to remove colliders from compounds colliders for example. I use own solution for interacting with individual cells, using mouse pointer. Otherwise, I need regenerate compund collider, every time number of cells entities is changing in lifeform entity.

3 Likes