Search Unity

truck making tutorial.

Discussion in 'Scripting' started by markis, Nov 27, 2010.

  1. markis

    markis

    Joined:
    Oct 11, 2010
    Posts:
    51
    Hello, can someone tell me how to make realistic truck like this:


    or if you know the link to tutorial.
     
  2. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    blender and lots of patience
     
  3. markis

    markis

    Joined:
    Oct 11, 2010
    Posts:
    51
    i have model and i can make truck like a car, but how to join trailer?
     
  4. Hintze

    Hintze

    Joined:
    Nov 6, 2009
    Posts:
    40
    joint?, dont know if it would work, but that is what makes most sense to me.
     
  5. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    Your answer is not simple, there is no tutorial for creating a trailer and a rig to do it all. I will give you a hint. (Yes, I have a script which handles joining and dis-joining trailers such as the rig that you have in your video. And it works perfectly.)

    Create the trailer as a separate object, have a point on the trailer and the tractor which defines where they meet. When they are close, realign the trailer to match it to the trailer point. Once you are done with that.... you will want to use something like this:

    Code (csharp):
    1.  
    2.                 joint=transform.gameObject.AddComponent(ConfigurableJoint);
    3.                 joint.anchor = fifthWheel.transform.localPosition;
    4.                 joint.axis = Vector3(0,1,0);
    5.                 joint.xMotion=false;
    6.                 joint.yMotion=false;
    7.                 joint.zMotion=false;
    8.                 joint.angularXMotion=ConfigurableJointMotion.Limited;
    9.                 joint.angularYMotion=ConfigurableJointMotion.Limited;
    10.                 joint.angularZMotion=ConfigurableJointMotion.Limited;
    11.                 joint.lowAngularXLimit.limit=-120;
    12.                 joint.highAngularXLimit.limit=120;
    13.                 joint.angularYLimit.limit=10;
    14.                 joint.angularZLimit.limit=10;
    15.                 joint.breakForce = 500000;
    16.                 joint.breakTorque = 500000;
    17.                 joint.connectedBody = connectedTo.rigidbody;
    18.  
    Note the breakForce and breakTorque.... It will disjoin by it's self.

    Again, this is my code, it creates the configurable joint needed to have the rig work correctly.

    Will I give this entire piece out, no... It is part of what I am working on and hope to get some cash flow out of. How long did it take me. About 6 hours of coding and testing. Again, works perfectly.