Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Mechanical Rigg in Unity

Discussion in 'Animation' started by Psyminator, Mar 30, 2015.

  1. Psyminator

    Psyminator

    Joined:
    Mar 30, 2015
    Posts:
    9
    Hi
    I'm having som problem making this rigg to work in Unity. In Maya I just use IKs to make the hydraulic looking cylinders move into each other when the arm elbow rotates from its joint. But it won't work in Unity. I downloaded Dozer's Inverse Kinematic but I just can't make it work. It says something like; can't add script component. Make sure there are no compiling errors... Also I don't know very much scripting at all.

    I've been experimenting with som joints and rigidbody components. But it all went banans!

    I really want this to work because it's for my internship for an important job I need.
    So I'm extremly thankful for all the help I can get =)

    The problem can be discribed with this picture:
    http://cargocollective.com/albertakesson/ISSUE
     
  2. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    Even if you wrote, it has to be in realtime, you can still animate the timeline of the animation, which would result in the same thing you want to achieve with an extra added IK in Unity. As your movement is only in the y direction, the animation way would be the safest, as you have full control of how it should look like.
     
    theANMATOR2b likes this.
  3. Psyminator

    Psyminator

    Joined:
    Mar 30, 2015
    Posts:
    9
    Unfortunatly I can't preanimate the motions becaus the picture is just a smaller part of a bigger machinery that is supposed to take input from a player. The rigg has to work in realtime. Imagine it like a crane or an excavator or somthing kike that.
    This seem to be a real problem in Unity. Don't now what to do. If I could export the animation from Maya the problem would be solved. Though it cannot be like that... =/
     
  4. Psyminator

    Psyminator

    Joined:
    Mar 30, 2015
    Posts:
    9
    I've learned that maybe the problem can be fixed with a look-at script... Though I'm not good woth scripting at all.
     
  5. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Yep look @ look @. :)

    I believe there are some cheap IK assets on the asset store as well. May try that too.
    Here is one for free.
     
  6. Psyminator

    Psyminator

    Joined:
    Mar 30, 2015
    Posts:
    9
    Hi there!
    How nice of you to reply =)

    The old Dozer's IK, I tried it. But it doesn't work. It says there is something wrong with the code... (?)
    Also I tried to copy the LookAt-script from a tutorial video from this site. Yet is seem to something wrong with that code as well. I don't know why. Probably something elementary because I'm very bad with scripting.

    Maybe I should try Java insted of C#? Or is there somening more needed in the scrip?
    They're all here:
    https://unity3d.com/learn/tutorials/modules/beginner/scripting/look-at

    I probably should change 'CameraLookAt' to something else as a variable. But I don't know what? It's supposes to be just a bone or joint from Maya. Yet I cannot apply the script at all, even as it is.
     
  7. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Sorry brother - no script knowledge here. :)

    I think you're on the right track. May want to do a simple prototype with only upper arm, lower arm represented by two simple mesh objects and the two actuator parts represented by two cylinders in a empty scene until you get it working properly.

    I also think this could be done with 1 animation that is driven by the upper arm as @asd234w4r5 suggested.
    That's how I'd go about it without any current experience with IK in Unity.