- Home /
How to make an arm with multiple, controllable joints?
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.
I started some prototype work on something similar. It was s flexible rod that needed to bend and push back when the tip was anchored, and need to flex certain ways based on controls. Using ConfigurableJoints I got be further than other solutions, but I deter$$anonymous$$ed it was never going to work. There were too much "sloppiness" with the Physics engine. I was at the point of calculating a very simplified physics for the rod when the job fell through.
Hm, not encouraging, but thanks. What I'd like is a configurable fixed joint, where I can adjust the angle between the parts like I can a transform, and have it affect all the rigid bodies it's attached to. I'll probably suggest that as enhancement.
Oh well, if I ever have to simulate a flopping fish, I know what to do.
I am also doing a simulated driving excavators and I really need help and guidance from all of you. Pls, share...
Answer by Barachiel · Aug 30, 2015 at 10:50 PM
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.
Problem we were having was some stuff we'd put in that was outside of Unity physics. When we just use Unity physics (PhysX), we get the desired behavior with the bucket being able to push the body off the ground.
Relying solely on Unity physics we do get some odd twisting, but that's another question
Answer by inum76 · Oct 07, 2015 at 01:22 AM
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.
Your answer
Follow this Question
Related Questions
Hingejoint: how to change axis correctly? 0 Answers
Hinge Joint connected to moving object - not aligned & straighten 2 Answers
Getting a ball to settle between two points. 1 Answer
How to connect kinematic and non-kinematic Rigidbodies with hinges? 0 Answers
HingeJoint Motor's values not being changed by script (show in debug, but not inspector) 1 Answer