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

Excavator simulation

Discussion in 'Made With Unity' started by Jean-Fabre, Nov 12, 2010.

  1. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Rohan,

    Thanks for posting here, indeed your set of questions is very interesting, so It's good if others can benefit.

    CAD models and mass: in short, the main trick to build a realistic behavior is to not try to stick to the real "theoritical" values, of mass, forces etc. For example, my rig has most of its different physics models set no mass, only the track frame and the cabin and the bucket do have a mass, and it's not event a realistic amount. because we are in a virtual environment, we are free from these constraints and I like to think it's good to take advantages of that luxury. For me to be able to achieve a stable excavator rig, I had to not use the real values but instead find out how to please the physics engine so that it behaves how I wanted. It might very well be possible to build a rig that use true physics properties, but I would think it requires a lot more work up front and a lot more research in order to achieve a stable rig like mine.

    CAD models WILL have to be rebuilded to follow real time engines requirements. CAD models are often/always sub optimal, with too much mesh definition. So you will need to find talented artist to create realistic real time friendly models of your excavator. One of the best, actually the best I have ever seen is him: Papillon do get in touch with him, his rate are acceptable and his work is simply outstanding and does fit the realtime engines requirements.

    Also, creating the rig in your 3d software, like mx or maya, can not be a pur export from your CAD environment, that won't work. You will need to create the hidden rigging frames and models used for the physics.The nice models are just here for the realism, they do not take part of the physics simulation, another very important thing to know.

    Force feedback: You will have to write your own system for that, in order to track accelerations. but knowing acceleration is the easy part, it's building the communication protocole with the real device that is going to be tricky. I am not aware of any easy, plug and play way out of this currently.

    If you do have a device ready to accept input to give the user force feedback, all you need is to write a dll that communicate to it, using sockets or any similar means of communication, you could explore also arduino it could be a good cheap solution to get it up and running, and some examples exists showing unity and arduino working together.

    Operating with joysticks is easy, my excavator is also pre configured to work with dual pads joysticks. I am currently working on a project that use a real control device for a big industrial robot, but luckily the command where simple, and simply emulating keyboard did the trick, but here you want joysticks and smooth controls, so one way would be to build a custom joystick that simply comply to how joystick communicates with the OS, Unity would simply treat it as a regular joystick. else you will need establishing real time communications between your device and unity, maybe/likely via sockets. It's feasible, tho I haven't tried using sockets for constant stream of data. Someone might step in with some more infos on this.

    If such communication was to be created, my excavator would be plugged straight away to it with no effort: Because I wrote my own input system, that works on top of the Unity input system. For example, as you control the excavator, you can se the various sliders moving, this is achieved by creating a higher level of input description to allow for bindings between multiple input sources down the road. This means in short that I can control this excavator by script as well, I could write a cut scene sequence and control the excavator doing stuff automatically. This would be the technic used if a custom device would be implemented to control the excavator.

    So, for your first phase. a lot of work will be required for getting your cad models into unity, efficiently. That is indeed the most difficult to get right ( well, at least the most underestimated tasks in such projects). The device, and force feedback is manageable, especially if you do have experience and knowledge of deal with the hardware part.

    Now, terrain digging simulation. I am not going to lie, I haven't even past the reflexion stade... cause it's too much in the current context of a personal project with no allocated time... Yes, you can dig holes in unity terrain, but linking the bucket movement, deducing the amount of ground to take, and how the ground is reacting to the various possible bucket movement will be very difficult, I mean VERY difficult. I have searched a lot on this subject, and even the simulator created for big excavator manufacturer, don't even come close to anything realistic and flexible, at best a small load of particles, which then relies on powerfull hardware to keep the frame rate up... and I doubt it was done inside Unity..

    You could tho investigate Fluvio on the asset store, it would be a good starting point for all the interection of the ground apart from the terrain itself.


    Bye,

    Jean
     
  2. WhiskyDelta

    WhiskyDelta

    Joined:
    May 18, 2011
    Posts:
    4
    Hi everyone

    I sent an email over to Jean and he urged to put it on the forums.

    Basically my first question, has been answered by looking at this thread in more detail..do you use IK? It would be nice to be in a postion where you can export you rmodel from Max, Maya, XSI etc with the full rig and IK and it be understood completely in Unity.

    My other question is about the shader used on the ground plane. I am developing this little model viewer for my 3d models, and i want the effect of a relfective ground plane, but things like the hard surface shadr oack, while great for some applications, doesnt quite work for this application.

    Regards

    Whisky
     
  3. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    thanks for putting it here, interesting set of questions:

    IK.. I am really shocked, that even unity 4 still doesn't seem implement an IK solution and that no one has ever publised a IK system on the asset store. Hopefully one day! by Ik, I really mean proper full house ik, no limbs ik for characters, oh well...

    now, the ground plane shader: It's basically a tortured night time water :) also check that the camera background is set to black, else you will get some blue because of the reflection.

    WARNING. it does require unity PRO.

    Please download this package. It's a scene using that set up. Tell me if this is what you are after.


    Bye,

    Jean
     
  4. WhiskyDelta

    WhiskyDelta

    Joined:
    May 18, 2011
    Posts:
    4
    Hi

    Thanks for the info..i took your idea and modified it slightly. As my "studio" scene is white i used the water pro mesh and material and just turned off the animation and fideled about with the settings until i was happy.

    Thanks for the help

    Regards

    Whisky
     
  5. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    Glad I could help :)

    Bye,

    Jean
     
  6. jimvanmil

    jimvanmil

    Joined:
    Jun 20, 2011
    Posts:
    20
    how do i make the hydraulic pistons between two objects. What hinge do i need and what kind of script is needed.

    Greetz,

    Jim
     
  7. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Jim,

    you do not need hinge, it's simply a "secondary" type of animation. For this I have a simple script that I share few post earlier on that thread, you can download it here:

    PistonKinematics.cs

    the related post where I explain how it works is here

    If you have any integration questions, let me know,

    bye,

    Jean
     
  8. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
  9. ThibaultD

    ThibaultD

    Joined:
    Jun 7, 2012
    Posts:
    10
    Sorry if this post highjacks your thread, but I've learnt so much thanks to the forums in general and your post in particular that I'd like to contribute. I'm working on an excavator simulator project, and I spent a good amount of time on terrain digging simulation. Because it's a professional project I can't post the full project, but I will explain some of the techniques I used. It might inspire people!

    The first issue is being able to modify the terrain in realtime. Modifying a Unity Terrain at runtime is possible (there are examples on forums blogs), but the operation is very expensive because Unity updates the internal Terrain collider after each heightmap update. One possible solution is to turn a Terrain into a collection of smaller and manageable meshes. The meshes I use are rectangular tiles (about 3m wide) which are built at runtime by sampling the height of the original Terrain at specific intervals (about 5 or 10cm). In order to make this collection of mesh look like the original Terrain, I had to use a custom shader that interprets the Terrain splatmaps and the attached materials, just like the original one. With this technique, the main limitation is that you can't plant trees, bushes, etc. But it's possible to set up a scene with a full-fledged Terrain for the background, and another Terrain used for digging. Dealing with meshes technically allows you to dig holes and caves, but it's already difficult enough, so for my project the tile vertices can only be modified on the Y axis (similar to the way heightmaps work with Terrains).

    About digging. Buckets have terribly unregular shapes so they can't really be reduced to a simple box or sphere for computations. In the end I use a mesh collider for the bucket. Then, at every frame I find the tile or tiles below the bucket, and for each vertex I cast a ray on the Y axis to hit the bucket (I know I know, casting thousands or rays at every frame is evil...) The points of collision tell me how deep the bucket is into the soil. So I can update the tile vertices and determine how much soil is removed. Some of that soil goes into the bucket, some of it is displaced. To know how much goes into the bucket you need to know how the bucket approaches the soil, using the direction of the bucket velocity vector for example.

    About dumping and soil displacement. What does not go into the bucket is moved at the edge of the bucket, in the direction of the bucket velocity vector. Again, a raycast against the bucket collider is helpful to find the edge. Then I dump soil at the edge. Dumping from the bucket and soil displacement are treated in a similar way. From the dumping spot, I progressively lay soil from the center outwards with a custom (and inefficient -_-) algorithm, so that the soil accumulates in a naturally conic shape which slope depends on a friction parameter. This is very far from a realistic semi-fluid motion simulation, and I'm still looking for better solutions, but at least it's one that can be used in realtime, with decent CPU/GPU.
     
  10. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Thibault,

    You are definitely welcome to post here :)

    I am glad my thread was useful to you, that's indeed also coming from a perspective of sharing back all the things I learn thanks to the community.

    I am impressed that you made such digging possible. too bad you can't share anything, a screenshot would be great :) My Main concern are buckets movement AI when for example the bucket is vertically hitting the earth, it's not taking any earth if I lift up again, or if I open and close the bucket while deep in the earth. Also when the hole starts to get big, digging the side would make earth falls into the pit, not stick to the bucket.

    My original idea was more to fill up the current slot where the bucket is with particles and skin particles with blobs mesh so that really the particle system do it jobs while a skin is applied on top. I think it would allow for a more realistic behaviour letting the particles system handle collisions for you.

    Have you looked at Fluvio 2? Not enough time during the day to experiment with this at the moment, but I think it could be a good start, in combinations with a mesh wrapping fluid particles to give an earth look, using a variation of blobs for example.

    Bye,

    Jean
     
  11. ThibaultD

    ThibaultD

    Joined:
    Jun 7, 2012
    Posts:
    10
    Here are some screenshots:





    For now, digging is only using the bucket but making the soil collapse by itself is something I would like to try.

    I don't know much about particles but when I checked Shuriken it seemed that particle collisions can only happen against plane colliders, which wouldn't be compatible with the irregular shapes of the bucket and the terrain.

    Also, our particular project includes other tricky issues like synchronizing more than 24 displays showing a 360 view around the excavator, which means that I can't use anything random or that I can't precisely synchronize across those displays. Particles are really convenient but they are not made to be individually synchronized. That said, if our customer wants to handle rockier (i.e. more "blobby") soil, I might have to go the Fluvio way and find workarounds.
     
  12. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Nice one! congrats on making it happen :) I need to allocate time and play around with this ground digging!

    Is a CAVE system not more appropriate than 24 display? pm me, I know people that implemented my excavator in CAVE so you get in touch with them

    bye,

    Jean
     
  13. ThibaultD

    ThibaultD

    Joined:
    Jun 7, 2012
    Posts:
    10
    Thanks for the idea but it's not for me to decide, and it's probably a bit late to convince the customer to switch now to a CAVE!

    Those 24 displays are projected on a 360 screen surrounding a cabin on top of a motion platform. I doubt that kind of large and heavy hardware setup is manageable inside a CAVE.
     
    Last edited: Oct 18, 2012
  14. omarzonex

    omarzonex

    Joined:
    Jan 16, 2012
    Posts:
    158
    wow

    very very good jop

    example script extrude dirty

    or other
     
  15. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    950
    That depends on the excavator. I'm not entirely certain anymore, but I think ours had 2 single direction ones for driving and one analog one for controlling the arm.
     
  16. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Puppeteer and Wolfos,

    I have seem now more intellogent control like you don't control each arm individually but more the direction of the bucket, it's getting more and more like industrial robots AI controls. But they still do use joysticks yes.
     
  17. ViktorHugo

    ViktorHugo

    Joined:
    Nov 4, 2012
    Posts:
    3
    Hi , im Viktor . i see your project jean (Excavator) and is realy kooll :D, i need make a robotic arm whit a pincer, i could make it whit parenting part an rotate the pivots. But i wanna meke the robotic arm whit joint and the pincers too. i dont know to use configurable joint and i'd appreciate if you tell me how to use it or show me any example.
    PDT: Jean Fabre deserves a star in the walll os fame of Unity xD.
     
  18. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Victor,

    Thanks :)

    there is a sample available on this thread, let me give you a direct link to the post itself: configurable joint sample

    With this, it will give you a very good abstraction component. With this, you will avoid all together having to configure a configurable joint.

    Now, given your description, I think there is a slight twist with pincers, is it a simple pivot point or does it have a second link to keep the two pincers parralels as they open and close themselves? if that's the case, then it's slightly more complex and would actually require a different type of abstraction and handling.

    Could you give a screenshot of the pincers? you can pm me if you don't want this to be public,

    but I guess you are looking at something like that right? linked pincer

    or are you simply looking for this: simple pincer

    bye,

    Jean
     
  19. ViktorHugo

    ViktorHugo

    Joined:
    Nov 4, 2012
    Posts:
    3
    Yessss i Lookk For the Linked Pincerr! . your example is perfect to me ,i can read it and understand the system. but for the linker pincers how to simulate it ?

    Thansk 1000 thansk,
     
  20. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hello Viktor,

    Ok, I made a working sample of a pincer, using only configurable joints. There is only one side, but basically, you apply the same concept on your rig for both sides. I created the rig manually so it's all clean and to the point.

    Few key concepts to explain:

    -- pay attention to where the configurable joints are created. The claw itself is totally slaved, it does not implement the joint to the link arm, instead the link arm and the main arm host the joints and both slave the claw, which results in a mechanically correct behaviour.

    -- I control the main Arm z angle, so currently I simply inject the raw z value in the rotationTarget quaternion. If you want true angle input, you'll have to work with quaternion a bit, but that should be straight forward enough. You can use here my pivot joint builder instead if you want I wanted this example to be all manual, but obviously, the pivotJointBuilder would be a good fit.

    -- I created several cubes around the system to validate it's stability. Notice the heavy cube, I would discourage to have such range of weights tho, keep things lightweight.

    -- I haven't modified the physics settings. I would however increase the solver iteration count. I tested up to 60 where the heavy cube actually stays on the claw. So if you feel that your rig is too soft and weak, increase the solver iteration count, but be careful and always test on the final device or computer, because mac and windows and IOS have very specific implementation of the physics engine with very different results sometimes.

    DoubleJoints.unitypackage

    If you have any questions, don't hesitate.

    Bye,

    Jean
     
  21. imamizer

    imamizer

    Joined:
    Mar 7, 2011
    Posts:
    20
    hello jean.

    i m working on an excavator simulator like yours. i ve done good progress so far and your example helped me alot to overcome most issues. it is almost finished now but there is a problem that i can not solve no matter what i try.

    i just want to make joints (configurable like yours) to stay put (like 2 wooden plank nailed each) on idle. it is already standing still while idle, cos excavators arms have 0 mass and they are not being affected by gravity. also no drag force. but when i push ground all arms response and even idle joints move.

    one of your posts on forum i saw you said you are setting joints to velocity->position for being more stable in idle state. i also tried that but appearently i m missing something. what is your mass your of your arm parts?

    any help you can give will be greatly appreciated. thank you
     
  22. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Imamizer,

    Yes, I am using a combination velocity and position control in my excavator but I think it's for a different problem then yours. Could you pm me a video of that behavior, I might be able to understand better what could go wrong in your case.

    My arms also have a mass of 0, apart from the bucket that is 1. and the track frames that is 20, so that the excavator has some mass in the end to stay on the ground and counter the objects mass you can transport with the bucket.

    One solution for your cas is to switch from configurable joint to fix joint when the arm doesn't move anymore, that's something I haven't yet experimented with, but ought to work and provide a good and stable behavior when arm is resting.

    If you want to use my solution, please downloa this sample, where it uses the exact same component and setup as my excavator. Tell me if that helps:

    simplejointdemo.unitypackage

    with the related thread:

    If you have more question on this, let me know, but that should do it. Remember, this demo uses a system I built on top of configurable joints so that you don't have to set it up manually, so study carefully how things are setup, then you'll be able to extrapolate and apply it in your project.

    Bye,

    Jean
     
  23. imamizer

    imamizer

    Joined:
    Mar 7, 2011
    Posts:
    20
    thanks for quick reply Jean.

    i checked your example again. theres also same problem exists. i placed a plane as a ground just beneath the cubes. when i move arm from middile cube, first cube (bucket lets say) that touches ground is also rotates, slides on ground. but i want idle parts not to react any force aplied by connected parts.

    i tried to set joint limit to 0 but as you know i resests its position back to starting position.
    i tried to lock rigidbodies related rotate axis' but it caused some jerky behaviour.
    i tried to set angle spring and damper parameter but nothing happened also.

    it seems swaping joints configurable to fixed is most solid solution. it requires some more coding work which i try to avoid after all this tries but nothing left to do appearently. i ll try that and let you know if it works. maybe just removing joints and parenting might provide a solution as well. we ll see.

    thank you
     
  24. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    Have you applied enough strengths to your configurable joints? also have you increased the physics "solver iteration count" settings, mine is set to 40, try this, cause it does stiffen your righ big time, that might be just what you need here. I have also decrease the fixed time step ( time settings), try this too.

    good luck,

    Jean
     
  25. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    there's two voxel assets now on the Unity asset store... check them out. thye might be what you need to move earth etc..

    There's also a free I.K asset on the Unity Wiki that works really well.
     
    Last edited: Jun 2, 2013
  26. DryTear

    DryTear

    Joined:
    Nov 30, 2012
    Posts:
    312
    Hey Jean, check this out : LINK

    this might give me you an idea, of actually carving out the terrains you got there ( but not meshes )
    and that video is only deleting parts of the terrain.

    to give an effect of picking up terrain, just instantiate a mesh inside the bucket based on contact point, and end point. so the mesh could have same amount of the carved area, and then dropping, check if the bucket hits a certain rotation deegre level, destroy the mesh, instantiate particles, so it gives on an effect of dropping dirt. and then add height to terrain each collision with the particles.

    just an idea, could be possible.

    Or another way is how Banksy said so, use a voxel terrain, where the terrain is formed by perlin noise, but then your terrain will form out chunky, and that could be solved with marching cubes. Like here : LINK

    mgear can help you too.

    I really like your virtual toy excavator playground game, brings back memories where we used to play in the sandbox with sandcastles and action figures :)
     
    Last edited: Jun 2, 2013
  27. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Thanks guys for the interest and links :)

    My main concern is not actually deforming the terrain itself, but yes, Voxel terrain seems a real good start for this, instead of unity Terrain.

    I am concerned about the behavior of the mud moved by the bucket, I'd like some strong realism here. Like leveling bumps with the bucket, or provide realism in the way the dirt falls from the bucket as it opens and closes etc. Definitly a challeng if you don't control the computer resources, cause so far, I only see one way: Fluvio 2

    bye,

    Jean
     
  28. hawx

    hawx

    Joined:
    Sep 29, 2012
    Posts:
    95
    Awesome job , If you coded an input for the excavator to move , then it would become a concept with lots of possibilities. Well done. Keep up the good work.
     
  29. DryTear

    DryTear

    Joined:
    Nov 30, 2012
    Posts:
    312
    Yes since the arrow keys or WASD isnt used, moving the operator isnt hard at all, and since it isnt a character(so the excavator wont jump :D), you can use transform.Translate();
     
  30. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    uhm, you can move the excavator indeed. Do you have problems moving it around? you can go up the hills and all. use the arrow keys ( not WASD)

    you can control each track individually as well with IKOL keys ( it's more like the way you do it in real, with two levers)

    I should make this clearer, I realize this now... :)

    bye,

    Jean
     
  31. obd2works

    obd2works

    Joined:
    Jun 6, 2013
    Posts:
    1
    seems very powerful
     
  32. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    It is :) do you have problem with the web player? you can download also desktop version for mac and windows. scroll down on the landing page:

    http://www.fabrejean.net/projects/excavator/

    Bye,

    Jean
     
  33. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Everyone,

    Wanted to thank you all for your comments and constructive ideas that you left on this thread, or via the application itself. http://www.fabrejean.net/projects/excavator/ just reached this morning the 10,000 viewers in 3 years, with more than 8000 unique visitors. I certainly wasn't expecting this when I did it :) Considering I am not playing the "social network" card at all, it's not bad at all indeed.

    Also, many of you enquired about some new updates. I am indeed working on a nice update, where you'll be able to control this excavator with your smart phone! I started on a new personal project this year, R.mote. I started a thread on Unity forum as well, while in closed beta, just to get an idea of what you would expect from such system and all. So stay tune for more!

    Have a good day everyone!

    Jean
     
  34. Goss

    Goss

    Joined:
    Dec 6, 2012
    Posts:
    11
    The simple joint demo link seems to be down. Can you please re upload it? Thanks!
     
  35. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    I am currently travelling to Unite 2013, so allow me some time to look into this, thanks:)

    Bye,

    Jean
     
  36. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi,

    The link to the Simple Joint Demo is up, I double checked. Can you try again now? if you don't get this to work, let me know, Maybe something is wrong with DropBox.

    Bye,

    Jean
     
    Last edited: Sep 9, 2013
  37. gl33mer

    gl33mer

    Joined:
    May 24, 2010
    Posts:
    281
    Hey Jean.

    Thanks for sharing all of this.

    Have you tried Fluvio2 (there's a free edition now) - for gravel spillage, etc?

    There's also PolyVox which is free and may work for digging.
     
  38. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    This is awesome.
     
  39. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi, yes, I am very actively surveying all these coming systems, but so far, I haven't found the right approach to build what I envision really. My real issue is the behavior of the bucket when it doesn't digg in a conventionnal way, for example, if I the bucket is half way and move left or right, I need to move the earth, not just lift it up, so there is a very complicated interaction taking place here, and so far, only true fluid simulator and a proper blob mesh system to wrapp these particles to look like earth and gravels is suitable currently, but that means too much to compute for a conventional computer.

    Bye,

    Jean
     
  40. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Thanks :)
     
  41. Becoming

    Becoming

    Joined:
    May 19, 2013
    Posts:
    781
    Hey just had some fun with your demo, really nice! i had accidentally positioned the arm in a way that i almost tilted the whole excavator over... since then i tried for half an hour to do it again on purpose :D that brings me to the thought, shouldn't this actually be possible quite easily? I think i saw this in videos...

    However, i read there was some conversation about real digging and i wanted to point something out to you that might be helpfull:
    With Terrain Composer from Nathaniel Doldersum(look on the assetstore) you can deform unity terrains with meshes. It can add/substract meshes from the terrain(though top planar only but i think for digging this would be enough). I was talking with him and it should be possible on runtime as well. Maybe you want to contact him and see if this could be used for digging.

    Cheers,
    Peter
     
  42. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Peter,

    Yes, it's possible to tilt the excavator completly and have it sit on the side and recover:





    For terrain digging, I am leaning toward a voxel based approach, but thanks, I will keep on eye on that one, I did not know it could deform terrain this way.

    http://u3d.as/content/dr-b-/ruaumoko/4yX seems to be the best candidate for me.

    Bye,

    Jean
     
  43. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Jean,

    By following this thread, it seems that you did not use those pistons/hydraulics for controlling the arms, instead, you used configurable joints to control the arms of the excavator, and use `look at` constraints for the pistons/hydraulics animation. Is this because of Unity's limitation or better performance?

    -ikel
     
  44. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Ikel,

    Indeed, I went for a non realistic rig in terms of set up, weights, forces and joints setup. My goal was to achieve a realistic behavior, not a true to realistic rig.

    It is completly feasible to use pistons as actuators to control the arms, I did experiment with this and it worked. I don't see why that would not work if applied globally on such excavator, tho, I think it will add more computing and potentialy less stable rigs, so I would not encourage this in a real project, but as an experimentation, it's totally doable.

    The biggest struggle for this kind of rigs is the number of links (Bucket-arm-arm-arm-body-track) is really giving trouble to the physics engine. This aspect of the rig is more problematic than using a configurable joint acting as actuator as opposed to a piston like the real thing.

    Also, in terms of reusability, I find it easier this way, because pistons are simply secondary animations, and switching rigs and reusing my configurable joint wrapper is very powerful: typically, even the wheels that drives this exacavator are using this wrapper! so everything you control here is using the very same component which is very flexible and fast to setup.

    Bye,

    Jean
     
  45. NutellaDaddy

    NutellaDaddy

    Joined:
    Oct 22, 2013
    Posts:
    288
    COLD TEA? Where the coffee lovers at?
     
  46. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Hi Jean,

    Thanks for the condensed explanation. I managed to create a similar link with the pistons as secondary animation. But I am not able to achieve the pistons as primary actuator. I thought you did not do it this way because Unity's joint (Physx) system won't allow it. I'll keep on trying.

    Yes, I realise there is a long link in your excavator simulation; bucket--arm--arm--arm--body--track. I suppose increasing the iteration and lowering the timestep would help? I'm just guessing.

    Thanks,
    -ikel
     
  47. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hi Ikel,


    Indeed, physics Iteration and timestep tweaking is mandatory in this type of rigs.

    You'll need to use a configurable joint to simulate a linear actuator:

    lock all angular*Motion
    Lock all but one *Motion ( actually use Limits I would suggest)

    use TargetVelocity to move the piston on the free or limited axis.

    WARNING: do not use TargetPosition, because if you target a position that your rig can not physically reach then your rig will "Explode" as you increase the distance between the current rig and the desired target. That's what I always use Velocity to control my joints. I'd like more information on a possibel alternative but never found any documenation or clear explanations on how to do it otherwise.

    One more thing that I forgot to mention on using pistons is that it create a rig that is HyperStatic and can be source of more trouble for the physics engine ( less stable)

    Bye,

    Jean
     
  48. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Jean,

    May I ask, how did you attach colliders to the joint? Did you use mesh colliders of each arm or simple boxes?
     
  49. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hello,

    I use special mesh colliders, to create the best envelop possible around the real mesh and various constraint of the rig ( you'll notice the missing end bit of the third boom, this is in purpose for a trouble free rig. I could have done it with boxes, but within max, it's all easy to build that and the bucket is a complex concave collider that I wanted optimized. My fbx has to follow conventions in content, hierarchy and object naming, and then within Unity, it all fits nicely and thing are greatly automated ( I don't like manual setup and repetitive tasks on each iteration of a work :) )

    $excavator_physics_rig.png

    So, colliders are attached to gamobjects that in turn are "joint" together using a "configurable joint" unity component controlled by a proxy behavior I created for this specific need ( a pivot point joint, highly configurable AND stable under load). You can find an example of this proxy and how it works on a package I attached to this thread on the following post:

    http://forum.unity3d.com/threads/66871-Excavator-simulation?p=847590&viewfull=1#post847590


    Bye,

    Jean
     
  50. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Hi Jean,

    I did a similar setup, but I used boxes. I used configurable joints all over the place. When I attach coliders, whether it be boxed or meshes, my joint starts to spring around. I'm somewhat puzzled here. I have no overlapping collider objects. Thanks for sharing. I wonder what went wrong.