How to make unique collider from box collider?

Hi,

I’d like to know how can I change a box collider of game object to unique shape collider.
It is very important, because I can stop the pass through with collider.
On the picture with yellow colour you can see the default box collider and
with blue what I need.

Any help will be helpful.

What about using a MeshCollider instead? :slight_smile:

Compound colliders are your friend. Just add multiple box colliders. Or make a simplified mesh and use it as a mesh collider.

Thanks, nice ideas. I have tried compound collider plugin and it is good solution, when the object has one mesh.
The best way for me is mesh collider. I have the all 3D models, than I can make simply mesh for these.
I attached one and you can see it on the picture. The problem is, if I use convex and trigger, then the mesh is changing to box.
How can I detect mesh collider maybe with collision enter?

using System.Collections;
using UnityEngine;

class drag_mouse : MonoBehaviour
{
    private bool Triggered = false;
    private bool dragging = false;
    private Vector3 distance;
    private    Vector3    scanPos;


   
   
    void OnMouseDown()
    {
        distance = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y,Camera.main.WorldToScreenPoint(transform.position).z)) - transform.position;

        dragging = true;



    }
   
    void OnMouseUp()
    {
        dragging = false;

        if (Triggered)
        {
            transform.position = scanPos;
            Debug.Log(name + " Vissza az érintkezési ponthoz");
           
        }


    }
   
    void Update()
    {

            gameObject.name = gameObject.name.Replace("(Clone)","").Trim();
        if (dragging)
        {

            if(Input.GetKeyDown(KeyCode.A))
                transform.Rotate(0, 90, 0);
           
            if(Input.GetKeyDown(KeyCode.C))
                Destroy (gameObject);
           
            if(Input.GetKeyDown(KeyCode.D))
                Instantiate (gameObject);
               


            Vector3 distance_to_screen = Camera.main.WorldToScreenPoint(transform.position);
            Vector3 pos_move = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance_to_screen.z ));
            transform.position = new Vector3( pos_move.x - distance.x , transform.position.y, pos_move.z -distance.z );




        }
    }
   

    void OnTriggerEnter (Collider myTrigger)
    {
        if(myTrigger.gameObject.tag == "Player" || myTrigger.gameObject.tag == "Falak")
        {
            dragging = false;
            scanPos = gameObject.transform.position;
            Triggered = true;
            Debug.Log(name + " Triggered");

        }
    }
   
   
    void OnTriggerExit (Collider myTrigger)
    {
        if(myTrigger.gameObject.tag == "Player" || myTrigger.gameObject.tag == "Falak")
        {
            Debug.Log(name + " Snap feloldása Drag alatt");
            Triggered = false;
        }
    }
   


    // This is idea for mesh collider
    void OnCollisionEnter(Collision collision)
   
    {
        if(collision.gameObject.tag == "Player" || collision.gameObject.tag == "Falak")
        {
            dragging = false;
            scanPos = gameObject.transform.position;
            Triggered = true;
            Debug.Log(name + " Collided");
           
        }
    }



   
   
   
}

Convex does Not change this into a box collider !
However, it would be (and is) expected behavior if the Mesh Collider you show there looks like a box (if convex), because the mesh collider is then generated in a way like you wrap something in plastic wrap…


That does not solve your second problem?