Search Unity

How can I make a conveyor belt?

Discussion in 'Editor & General Support' started by dock, Nov 17, 2008.

  1. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    382
    I'm trying to make a physics driven conveyor belt at the moment, and I tried to make one from cylinders rotating but it doesn't seem to work very well. I have to put the friction really high, and even then it slips unless it rotates very slowly.

    Is there a better way to make a simple conveyor belt?
     

    Attached Files:

  2. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    To accomplish this I would probably not use physics directly, and instead write a script that on collision with the rollers added a horizontal force to the box. There's probably a way to have the center of force at the point where the collision occurs which would heighten the realism a bit (that way if the belt touches a corner of the box it rotates the box while propelling it). If you went this route you could then create a model that looks more like a conveyor belt (instead of rollers).
     
  3. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    382
    Oh you're right, that works pretty well! Thanks!

    I wonder how I can put curves in the conveyor belt with this method, but hopefully with some well thought out colliders it should naturally follow a path with some encouragement. Hmm.
     
  4. Arges

    Arges

    Joined:
    Oct 5, 2008
    Posts:
    359
    Perhaps by applying the force in the original "forward" direction of the roller that the box is colliding with? A slowly curving path should yield a series of forces that make it turn.

    I'd also keep some borders, to "fence in" the box just in case.
     
  5. Bones3D

    Bones3D

    Joined:
    Apr 28, 2008
    Posts:
    314
    Hmm... how about using a surface dotted with spheres to create an air-hockey like effect by making the spheres act as ball bearings?
     
  6. careyagimon

    careyagimon

    Joined:
    Dec 20, 2007
    Posts:
    209
    This worked well for me:


    Code (csharp):
    1.  
    2. var speed : float = 2.0:
    3. OnTriggerStay(other) {
    4. other.rigidbody.MovePosition(other.transform.position + transform.forward * Time.deltaTime * speed);
    5. }
    6.  
    7.  
    It's kinda in-between physics and kinematic. ie It's really predictable and simple, but it's still dynamic.
     
  7. juber824

    juber824

    Joined:
    Feb 8, 2014
    Posts:
    1
    tsyrchurn likes this.