- setting localtoWorldComponent ( does not work )
- setting Scale component gives error because no scale component exists
- setting CompositeScale component gives error because no scale component exists
using Unity.Mathematics;
using Unity.Transforms;
float3 newScale = new float3{ x=3f , y=3f , z=3f };
if( entityManager.HasComponent<LocalToWorld>(entity) )
{
var ltw = entityManager.GetComponentData<LocalToWorld>(entity);
entityManager.SetComponentData<LocalToWorld>( entity , new LocalToWorld{
Value = float4x4.TRS(
translation: ltw.Position ,
rotation: ltw.Rotation ,
scale: newScale
)
} );
}
else Debug.Log($"{entity} has no {nameof(LocalToWorld)} component");