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

Need help making a transformable mechanism work!!

Discussion in 'Physics' started by iandresolares, Aug 11, 2021.

  1. iandresolares

    iandresolares

    Joined:
    Aug 5, 2021
    Posts:
    2
    Hello,
    I'm working on a mobile robot simulation in unity, the robot is compund of 4 transformable wheels, this wheels need to rotate as any other wheel but they also need to be transformed, the transformation mechanism is complex but my goal is to simplify in the simulation to make it feasable and easier to simulate in unity. I have used hinge joints to rotate the hole wheel and make the robot navigate, and this works fine. upload_2021-8-11_11-55-49.png
    However when it comes to the transformation (I attach some photos of the wheels in 2 different positions) I am not able to make it work. It should be as simple as rotating the pink and yellow discs in oposite directions if all the other components collide correctly with each other.
    upload_2021-8-11_11-58-29.png
    upload_2021-8-11_11-58-53.png
    Do you have any ideas on how I could accomplish this? For now I have tried with hinge joints but the wheel basicly goes crazy, I have also tried with a simplified version and didn't work either, I'm quite new to unity so any help is really appreciated.
    Thanks!!

    Andrés
     

    Attached Files:

  2. Bobindiana66

    Bobindiana66

    Joined:
    Jul 25, 2021
    Posts:
    21
    Hi, to do this in CAO it is easy, on unity i know you can make the circle arc by equation and using lerp to join the start and the end points or could you make it with the kinetic


    and another with source code
     
  3. iandresolares

    iandresolares

    Joined:
    Aug 5, 2021
    Posts:
    2
    Hey,
    thanks for your answer, I could use lerp or anything else which would rotate one disc in the opposite direction of the other, however I need the other links to "follow" this rotation causing a different movement for each link, this second part is the one I am not able to achieve since objects don't seem to collide correctly to each other and the wheel just goes crazy instead of what it is supposed to do in reality.
     
  4. Bobindiana66

    Bobindiana66

    Joined:
    Jul 25, 2021
    Posts:
    21
    Mouvement patte.jpg Hi, in CAO wirh collider, turn only the disk blue. the disk green is locked.
    The rotation is on 360°.
    In unity i don't have the level to obtain the same mouvement. Sorry.........
     
  5. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    637
    This is a fixed part you can add to the robot, right?
    No parts of the wheel can be destroyed?

    Then you could just make an animation, attach seperate colliders to the parts and the Compound Collider (one rigidbody on the entire obejct, colliders as childs) will solve the collision detection. So friciton is the only thing you have to simulate by code - aka the forward movement. (unless the whole wheel rotates, then friction will be applied correctly, just add a physics material and make sure the wheels don't rotate at high speeds)

    Attaching a lot of joints usually makes the simulation unstable. You can increase some of the physics settings but it won't solve all your problems.
    Some code in the FixedUpdate() method can help you a lot here. The question is - what do you want to do with it?
    Is it a combat game where you build your own fighting robot? Is it a traversal game, where you can build your vehicle? Or is it a real simulation for technical use? (if it is the last one -> why on mobile?)
     
  6. Bobindiana66

    Bobindiana66

    Joined:
    Jul 25, 2021
    Posts:
    21
    Yes, the puprpose is to have one disk locked and the another is motor to make a cycle on 360°
    No parts destroyed it is right.
    This item is making by the first post iandresolares, i don' know is aim.
    Thanks for your answer.