I’m working on a simulator, similar to the showcased here (which I didn’t work on, but good job). The problem I’m running into is that real excavators can push themselves up by their arms. This happens when they’re digging, and sometimes they’re loaded onto trucks using this. It has to be in our simulation.
We have to control each of the joints, shown as red dots, using joystick axes, and there’s a good chance multiple joints will be moving at the same time. When the bucket pushes on the ground, it could cause the excavator to lift up no matter which joints are being controlled.
My first thought was to use fixed joints, making setting the isKinematic property for the rigid body that’s moving. This breaks when multiple parts are moving.
My next attempt was to use heavily damped hinge joints, adjusting the target angles of the springs based on joystick input. No matter how much I tweak it, I get something that looks more like a fish flopping around than a piece of heavy equipment.
Has anybody ever worked on a similar problem? Any help would be appreciated.
Just quickly messed around with this and, providing you’re willing to go the extra mile with convincing animations (or procedural ones) instead of relying on physics for all aspects, simply having a Rigidbody on the main body and using empty gameobjects between the arms to control their rotation achieved what you seem to be describing without any issue.
I’m not all that into excavators, so I don’t know what you’d need for it to look convincing, but for the particular mechanic you’re asking about, I’d start here.
angles with a vector3.
public Vector3 Vec1; Then you set your Quaternion with it, this way: private Quaternion QVec1; QVec1 = Quaternion.Euler (Vec1); QVec1 would be your set Quaternion with the angles you wish it to have. This is my vid on the subject you ask about, if you wish to check it out. Link: ConfigurableJointScript 1
The vid tells how to properly set TargetRotation within a script, and have it work!
Helps to have all joint Rigidbodys no more then a mass of 0.05, or the spring value will not work well.
You may also need to go into your PhysicsManager and set the Solver Iteration count to 18 and Default Contact Offset to 0.001. You might get less flopping then, but it’s not guaranteed.
Hope this helps.