Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question colliderbox not function

Discussion in '2D' started by superyolo, Oct 27, 2020.

  1. superyolo

    superyolo

    Joined:
    Oct 19, 2020
    Posts:
    6
    hello every one.

    I'am beginner and i need your help. I want to make a game of gestion with a system of convoyer belt in 2D. The camera is on the top and gravity is allong the z axis

    So i launched a new 2d project and i drew a really fast first prototype of convoyer belt. I added it in unity and now im tring to add coliderbox and rigidbody for make some scripts and for prevent GameObject to fall through convoyer belt. I also made on unity a 3Dcube with rigide body and collider box for do some test. The convoyer is at z=0 and i drop the cub at z=10.

    The problem that i have is my cube pass through the convoyer belt. I dont really understand because both have regidbody and colliderBox (not 2d collider or 2d rigidbody). MayBe i miss somthing. some one can help me?

    thank you in advance
     
  2. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,452
    Make sure your Colliders arent set to trigger. Also, you said you made a 2D project but you are talking about 3D objects so you may want to post this to a different section of the forum.

    I recommend a beginner video or two about Unity and its physics system to help you understand these things better.
     
  3. superyolo

    superyolo

    Joined:
    Oct 19, 2020
    Posts:
    6
    thank you for your reply.

    Yes i want do a game as factorio. 2d collidbox are just on xy plan. but here the gravity is allong z. For this reason i add 3d collider box. and no it's not set to Trigger.
     
  4. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,452
    Well, just start basic to make sure its all set up properly. Make a large ground object (Cube gameobject and stretch it out) with NO rigidbody and then another cube or a ball above it with both a collider and a rigidbody. Press play and see if they collide, they should if you use the right type of collider.

    I really recommend a video like this since you are a beginner:
     
  5. superyolo

    superyolo

    Joined:
    Oct 19, 2020
    Posts:
    6
    thank you.

    I want to do something as it's done on your video but in 2D.

    I know how function collider and same in 2d already did collide 2 objects on the xy-plan with 3dcolliderbox. I dont know why that should be problematic. it's like put a paper-sheet in a box. And it's not because unity call that 2D project that they is no Z-axies. Indeed when i set my cube at z=10 with gravity, it fall. So i dont really understand why its should be problematic.




    i want do somthing like that. as you can see it's a 2d game with convoyer belt. For that my method is to use gravity like that i can have 2different gameobject for convoyer and for other ressources and they can have a more or less realistic physics. but maybe unity in 2d game can't take into account colisions on the z-axis. maybe my methode is not the good one for a 2d game. but how can i do it that so?