Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

DOTS Transforms and UnityPhysics: no scale?

Discussion in 'Physics Previews' started by mikewarren, Jan 16, 2020.

  1. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    I'm looking for some insight on how the ECS transform components work with UnityPhysics. Specifically, I'm trying to create entities and entity components for ConvexColliders and raycasts.

    The documentation reads that Translation and Rotation components are required for casting and I've discovered that a LocalToWorld component is also required, though I don't recall reading that in the documentation.

    I see no mention of the Scale or NonUniformScale component with regards to UnityPhysics. It is used to calculate the LocalToWorld matrix, but that doesn't appear to be used by the raycaster. Is that correct?

    My goal is to create a single PhysicsCollider/ConvexCollider that can be added to multiple entities each with its own position, orientation, and size.

    Thanks.
     
  2. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Just to let you know,
    Did you try to use 2 or more simple colliders instead of ConvexColliders and compare performance?
     
  4. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    I'm not sure how your question relates to mine.
    BUT, I did find statements in the forum that indicated scale is not considered in DOTS physics casting. The examples I've seen bake the scale into the collider points.
     
    Last edited: Jan 27, 2020
  5. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    391
    I need to change collider size at run time and for simple colliders (sphere & box) I found that changing the scale of the entity did not work I had to make new PhysicsCollder and use SetComponent.
     
  6. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    The sphere collider has a radius field. Had you tried using that? I'm not familiar with the box collider, but I imagine it must have some sort of extents field.
     
  7. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    391
    I am using the sphere collider and radius now. Scale just seems to effect meshes and not colliders.
     
  8. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    I agree that scale does not affect the collider. I asked about sphere colliders because you can change the radius and obtain the same effect. I expect the box collider must have some sort of similar extents field.