Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Raycasting a rectangular prism mesh vs textured primitive "cube"?

Discussion in 'Physics' started by leapformula4, Nov 26, 2014.

  1. leapformula4

    leapformula4

    Joined:
    Mar 26, 2014
    Posts:
    50
    On the physics section on the tutorials it was stated that raycasting a primitive object styled to resemble a mesh was more efficient that raycasting a mesh.

    If the mesh was a prism would it make any difference in terms of efficiency?

    And is it possible to texture and modify a primitive object like a cube to resemble a rectangular prism brick(supposing the same texture was applied to all 6 sides of the prism)?
     
  2. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    Use whatever mesh you like in MeshFilter component, but if it resembles one of the primitive shapes (box, shpere, capsule) then add a primitive collider to your object (BoxCollider, SphereCollider, CapsuleCollider) instead of MeshCollider.

    Physics engine doesn't care and doesn't know how the object looks, it cares only about what type of collider is attached.
     
  3. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    It's totally cool to post pictures to help explain what you're trying to say