Search Unity

Why does Scale/NonUniformScale disappear?

Discussion in 'Physics for ECS' started by Sibz9000, Nov 15, 2019.

  1. Sibz9000

    Sibz9000

    Joined:
    Feb 24, 2018
    Posts:
    149
    With a Physics shape attached, I understand that the collider gets the scale baked in. But why is the scale component then removed?

    I just want to shrink my items to 0 scale, I no longer care about the collider, however it seems I must manually add the scale back on after the conversion process. In my case I do this along with the collision that triggers the shrinking, however it's seems a bit odd, it feels like I am going about it the wrong way, although it does work. I wonder how I get the items original scale (for now this doesn't matter, my items are all scale 1).
     
    Tony_Max likes this.
  2. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    353
    I have the same odd conversion result. Did you find the cause?
     
  3. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481
    Currently, Physics only cares about Translation and Rotation for performance and assumes that colliders are non-mutable. Better support for scaling colliders post creation is on the roadmap, and the current '5b. Change Collider Size' demo in the samples is also adding a Scale component during conversion.
    For clarity, in your usecase, setting scale to 0 is removing the rigidbody body from the simulation altogether?
     
  4. Sibz9000

    Sibz9000

    Joined:
    Feb 24, 2018
    Posts:
    149
    No. When I add a physics shape, it the scale component gets removed during ConvertToEntity. I have to add it back on after conversion. I imagine it's the physics conversion process removing it, probably because it uses the scale and bakes the collider, any further alterations to scale won't adjust the collider so it removes the scale component. In my case that is acceptable, I want to just scale the rendered side of things after a collision, a cheap disappearing animation.
     
    steveeHavok likes this.