Yoconn
February 2, 2023, 2:19am
1
How are you supposed to move a parent entity and have the child entities ‘follow’?
I’ve tried googling this but… I might be using the wrong terminology or something.
I’m working off the Boids example and this is what I’m currently doing.
localToWorld.Value = float4x4.TRS(
new float3(localToWorld.Position + (nextHeading * MoveDistance)),
quaternion.LookRotationSafe(nextHeading, math.up()),
new float3(1.0f, 1.0f, 1.0f));
localToWorld has changed it is now really only for physics interpolation / graphics.
See Transform concepts | Entities | 1.0.16
2 Likes
Yoconn
February 3, 2023, 1:26pm
3
Ah, so are we mostly working with the localTransform property now?
Tudor
March 22, 2023, 6:08pm
5
But how do you change the non-uniform scale if you shouldn’t use localToWorld?
ah, like this: How to scale a entity in a non uniform way?
magical hidden by default component, got it.
(the docs are very unclear what it is, "you may use a PostTransformScale (float3x3). This will be applied in the following manner: LocalToWorld = WorldTransform.ToMatrix() * PostTransformScale", had to search around a lot for usage and context; it didn’t even mention it’s a component or part of a component)
There is nothing hidden or magical. It’s clearly described in the documentation of entities package. If someone didn’t read docs, well…
1 Like
muntes
February 8, 2024, 11:58am
7
Hi,
Do you have any idea how to scale a child of a parent entity in a non-uniform way?
entityManager.AddComponentData(productEntity, new LocalTransform { Position = localMatrix.position, Rotation = localMatrix.rotation});
entityManager.SetComponentData(productEntity, new PostTransformMatrix {Value = float4x4.Scale(localMatrix.scale) });
For example this generates a 0,0,0 LocalToWorld.
muntes:
Hi,
Do you have any idea how to scale a child of a parent entity in a non-uniform way?
entityManager.AddComponentData(productEntity, new LocalTransform { Position = localMatrix.position, Rotation = localMatrix.rotation});
entityManager.SetComponentData(productEntity, new PostTransformMatrix {Value = float4x4.Scale(localMatrix.scale) });
For example this generates a 0,0,0 LocalToWorld.
LocalTransform.Scale isn’t set in that code, so it will be 0.