Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Physics Collider Scale at RunTime

Discussion in 'Physics for ECS' started by Ndogg27, Sep 28, 2023.

  1. Ndogg27

    Ndogg27

    Joined:
    Feb 3, 2023
    Posts:
    15
    I have read a handful of posts regarding this with older ECS versions and am hoping things have changed. I need to scale a physics shape mesh collider at runtime? Is this not possible?

    The manual says:
    Scaling colliders
    All collider types can be uniformly scaled at run-time when they belong to a dynamic rigid body. This can be achieved by modifying the Scale member in the entity's LocalTransform component.
    That sounds straightforward and simple, so I am doing something wrong or completely misunderstand this.
     
  2. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    265
    Uniformly scaling colliders through the LocalTransform Scale property will be fully supported with the next 1.1 release.
    There were various issues surrounding this feature which have been resolved.
    Also, any purely uniform scale present at edit time in your game objects will now be transferred into the runtime LocalTransform.Scale property. Previously, it was baked into the collider geometry and the Scale set to 1.

    Note that there is a runtime collider scale demo in the PhysicsSamples project which demonstrates uniform runtime scaling already in 1.0.
     
    Last edited: Oct 17, 2023
    Ndogg27 and Harry-Wells like this.