Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    103
    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:
    103
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,165
    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:
    103
    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:
    337
    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:
    103
    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:
    337
    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:
    103
    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.
     
unityunity