Home Game Development unity – Scale / NonUniformScale shouldn’t be utilized to entity

unity – Scale / NonUniformScale shouldn’t be utilized to entity

0
unity – Scale / NonUniformScale shouldn’t be utilized to entity

[ad_1]

I’m simply studying the brand new Unity ecs and attempting to vary the dimensions (scale) of an entity.
Everything works positive, I can change the rotation, the place however not the dimensions.

I’m questioning why.
I did varied tutorials, I attempted Scale, NonUniformScale, LocalToWorld, CompositScale however nothing works. Maybe a few of the strategies are deprecated.

Here is what I’ve tried to date.

I’ve a number of prefabs (planes) that are spawned appropriately and every of them having a rework element.

enter image description here

Now I wish to change the scaling of all of the planes.
For that I take advantage of a JobComponentSystem.
In the next pice of code the rotation works positive, however not the scaling.

I attempted LocalToWorld.

public void Execute(ref Rotation rotation, ref LocalToWorld scale) {
            rotation.Value = math.mul(rotation.Value, quaternion.RotateZ(math.radians(0)));
            scale.Value = float4x4.Scale(2, 4, 5);
        }

I attempted NonUniformScale

public void Execute(ref Rotation rotation, ref NonUniformScale scale) {
            rotation.Value = math.mul(rotation.Value, quaternion.RotateZ(math.radians(0)));
            scale.Value = new float3(2, 1, 4);
        }

I attempted Scale.

public void Execute(ref Rotation rotation, ref Scale scale) {
            rotation.Value = math.mul(rotation.Value, quaternion.RotateZ(math.radians(0)));
            scale.Value = 5;
        }

None of those is working.
What did I flawed (the dimensions simply stays at 10,1,10) or what’s the present propper means of doing that?

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here