Fixed, Spring, Hinge, Character & Configurable Joint explained – Unity Tutorial

Fixed, Spring, Hinge, Character & Configurable Joint explained – Unity Tutorial


In this video we will talk about all unity joins, so we will talk about fixed joint spring joints hinge joints character joints and configurable joints Yes we’re talking about all of them and you can find the time codes in the Descriptions so that you can skip all the parts. You don’t need at the time of the recording. You can’t find any Tutorial on YouTube that covers up all the joints of unity. So this is very exciting Let’s start. So we’re creating a plane position the plane at 0 0 0 and Yes, there we go we create one 3d object cube and We create another video. You object cube So let’s move up this a little bit more up and We create a rigid body This is kinematic so it won’t be affected by anything. So no gravity No other coli or no other objects will ever move this box Except I move it. So and This one is the other widget or e It uses gravity. Everything can be ever this by default and We start with the first joint, which is a fixed joint. So the fixed joint is very simple you can just Connect it to any other rigid body. So I Maybe I call this the connected rigid body So then it’s a little bit more clear Here we have added the joint and this is a connected rigid body there’s a break and a Force a break force and a break talk and you can enable collision what that means is Let’s create another cube and call this tube three cube and This has also a rigid body and has no gravity as you can see nothing happens So but this is a connect wicked rigid body. And as soon as I move the connected rigid body the other rigid body will also be moved by unity because it is connected to the connected rigidbody and Here is my free rigid body. I can’t move it into the other box but what I could do is I can just Set this break and talk And this break force at work force for example to 100? Maybe in edit mode 100 100 and this means if the force of 100 is applied to this box then this Complete joint will break so now it’s double I can move it. But as soon as I hit this very hard like this. Oh Okay, it wasn’t hard enough or the connection is too strong let’s set it down to 10 and try it again There we go, we break it now it’s completely broken The complete connection on the complete joint is gone now and you can do this with every joint so I’ll skip this in the next joint Next up is spring joint You do not have to set a connected which body but it makes things a little bit clearer Let’s start with a rigid body. Let’s remove the ground and I think we can start right there the Initial values I could enough for us and here you can see it’s connected to this one and Here is a button you can see it’s anchored right there. So when I move it As an anchor is right there. I can set the anchor. This is the first one to the middle and As you can see the anchor is in the middle It behaves a little bit different So it rotates a little bit more if I set the anchor back to 0.5 Its Again anchored at the top and you see the bounce pop there is that it’s an anchor So it goes a little bit down every time I change it here because it’s also configure the anchor I can just uncheck the box and then it should be a little bit easier to Change these values during one time. Yes. There we go And I can move this rigid body as well because this is the connected one if I do not have connected which body Then everything looks like this It’s still a joint but it’s not connected to this rigid body anymore Let’s be connected and Let’s talk about the other values if I increase the spring you can see it’s a little bit stronger I can increase damper decreases doing spring again. And you see it’s moving way slow work You see its damping. It’s not that It bounces so often So if I set the damper very high Let the cube fall, oh it’s not falling anymore. It’s it’s So and now You see There’s a high damper so these are the values booing and damper say They are returning and occurring in all the other joints, so keep in mind this is a spring as the force that is applied to the rigid body to reach a Specific position and the damper is a damper so it dams it on the way to the position if you have a spring and the damper there’s often a minute max distance and this indicates where the force is applied and where as a position or the target position of the rigid body is for example now, it’s Directly in this brown spot if I set it to one the target position is in the circle around a Brown dot so it’s either here or up here The force is applied always to the nearest position and the box twice to be around in this shape next up hinge joint as you can see it’s just this axis and the complete widget body is moving allowances access and you can use a connected rigid body to Just move it with a rigid body so, for example, I can connect it to our connected rigid body and now I can move the connected rigid body and The widget body underneath it or connected to it will move sim simultaneously and I can change the axis now. It’s X-axis I can set it to the z-axis and now it’s turning around this z axis I Can change the anchor? Which is maybe interesting, for example, I can set it to zero now the anchor is Directly in the middle of the box And if I rotate or move the box, maybe I have to potate it If I use the other cube to have some rotation There you go. You see it’s rotating around Itself because the anchor is set in the middle. Let’s move the anchor up a bit now It’s hanging Around here. And now we have the same concepts coming over and over again. Here’s the spring again For example, I can enter a spring value of 100 say ok. I will use the spring and avataric position and This tube tries to go to the target position with the force of the spring I can set it to 90 to rotate it around 90 degrees. I can set it to 180 I can we as a forest so That it tries to go to this position, but with a lower force maybe a little bit lower and then You see it tries to get to a certain position What’s really interesting is also if I sets anchor to zero again so that it’s rotating I can use the motor and the motor is just Too Force a rotation so you have sus insured and the motor always and constantly Adds force to it so that it rotates around this hinge axis, and I can use limit for example – 90 degrees and 90 degrees Check use limit and even if I use the motor to Rotate it. It will stop Directly here where the limit is I can say? Okay bounce a little bit at the limit then it bounces as you can see here and That’s everything. I got to say about the hinge joint next up the character joint This is a little bit more complex joint. It’s used for Characters and specific for ragdolls so you can use it on arm or something if you started it just Looks like a normal hinge joint But there’s one difference as soon as I collide with another object It’s in each joint and it can rotate. So this is a really real difference between those two Let’s see what you can do we can set a connected body as always so that it follows the connected body It behaves a little bit different you see it right here We have an access this is the main axis where this inch rotation or Galatian from the hinge joint is applied You can say twist swing and Twist limit and The same with a swing so the swing is everything that the hinge joint is also doing and the twist is just the rotation about this axis and you see The limit that already there I can’t rotate over a certain amount of degrees one last thing that is really helpful is Joined angular limit button here. You can set the limits here. It’s a little bit more visual for example as soon as I Decrease the rotation here It does not rotate anymore that much for example, I try to rotate it. It will always Reach the limited immediately so we can set the lab a little as a limit a little bit higher Or I can just change this limit or this one okay, the last one and the most interesting one is a configurable joint because this joint is very complex and unity Itself says you can do everything with it. You can do with other joints. So it’s a hinge joint It’s a spring joint it two-character joint. It’s a fixed joint. You can do everything you want So and this is a reason why it’s so interesting so you can see Everything you can know already from the character joint. You can have a connected rigidbody. Let’s started right away For example We can lock everything x motion Y motion that motion for example now it can lock the Y motion and We will see that the box is not falling down anymore as soon as we set it free it goes down so we can do it with every motion and also With the rotation we can set limits in every single way So spring limits or linear limits angular spring limits low angular X limits Y limits that limits wise at limits and one of the most interesting things is here the target position for example, the target position is now 0 0 0 that’s where the object is right now and You can use these drive values to add some force to the object so that it always goes back to the target position and the target philosophy velocity and Let’s add a hundred To everything and let’s see what will happen and as you can see as soon as I Drag it out of the position it always twice to get there as soon as possible always a force of 100 This is really interesting. But the rotation is a little bit strange It does not try to get back to the desired rotation and as you can see it Already uses an anchor for the force. I can set the anchor to zero now. It’s rotating Around every single axis we can do the same thing for the rotation. So the target rotation is here zero zero zero and We can Set the angular drive for X Y Z and No x y&z not this one And now the cube tries to go back to this position From everywhere. So I Can’t rotate the cube. I can move it it always twice to go back to this position and This is very interesting. Especially if you have a connected rigidbody It tries to go back to the position underneath the rigidbody and What we can do now is to use a configurable joint on The other widget body as well Connected to our cube And says is not Cannon Matic anymore and we can do as an exact same thing So we set the forces and now this cube tries to stay above this cube and this cubes that tries to stay above this cube, and they all using is spring and Maybe the spring value is a little bit hard Let’s lower the values a little bit maybe a long 10 and this is interesting. So they try to Avoid it each other and they are connected in some ways so that This is like a little jumping character instead of the angular drive you could use Slope drive, and this means this loved wife always tries to rotate around the axis with the least amount of degrees to the target rotation and It’s basically a little bit smoother and a little bit faster to move around this axis We could divide out. It should be the same result in general. Yes, as you can see It’s a little bit more stable even though I rotate the cubes a little bit so here are so many properties and If you have questions to one of these in specific, I can really recommend use a help page You can reach it via the questionnaire on the pork right here You click it and here are all the things in detail in the unity documentation with some graphics this is really one of the Components and said that has a really big documentation in contrast to the others So I hope you liked the video It was a little bit longer, but this is one of the videos I really wanted to make because it covers up all the joints that are and unity

33 thoughts on “Fixed, Spring, Hinge, Character & Configurable Joint explained – Unity Tutorial

  1. Nice tutorial again. I am new to game dev and was wondering if you could do a tutorial based on a mobile multi level game, explaining setting up of where the touch controller screen goes and a bit of explanation about correct use of 'game manager'. Is it possible to have the main character teleport into the level start and teleport out at the end of each level. Any help on these matters would be amazing, thanks, Paul

  2. how would I attach my character(which has a fixed joint) to a object like a cube through script? for instance I want to have a interaction script on the cube I want to pick up and have a interaction radius of about 0.4 so that when the character enters the interaction zone the fixed joint automatically enables between the two objects and he can move around with it

  3. Hellow, nice tutorial!
    But can you explain how ancor axis in configurable joint works? I suppose it needs for turning limit area.
    I'm making body with 2 limbs attached to it. And those limbs must have assimetrical angle limits on 2 direction.
    1) how rotate areas with this axis? Only x angle axis have min max setting.
    2) also areas on both limbs looking in one direction, but i need them to be mirrored. How to mirror them?
    I tried to change axis values and areas moved in weird way.

    May be i should use several hinge joints, but i think it will be harder to script.
    If so, i still want to know how axis work.

  4. Hello, why my hinge joint is looks like 2d ? i need to make like you but it looks circle, i need spherical hinge joint ? its only effected horizontal

  5. You think you could help me out: https://answers.unity.com/questions/1579139/hinge-joints-interfering-with-each-other.html

  6. So, for having a Punching Bag effect should I use Spring Joint??I think It makes sense….what do you think about ?

  7. 16:30 Shouldn't you have changed Rotation Drive Mode to Slerp as well? You basically just disabled springs here.

  8. Can you guide me where should a beginner like me start from i don't know about any of these like why to use this ?

  9. great video! I caught a really good second lesson and that is your rapid prototyping technique on a test project. This will save me a ton of time!

  10. Newbie here. Would a spring joint approach make sense for trying to create a pole vaulting mechanic? Or what would be a good approach for creating pole vaulting?

  11. Hi you seem to be the guys who may be able to help regarding, physics and configurable joints !! Im trying to build a real time bouncy blade for my fencing game www.ufencevr.com where the blade bends using physics both by gravity at its end, and bending uniformly against a collider , like the real thing, I have faked this using animations and physics combined, but its not the ideal solution. Is it possible to set up this type of action using configrerabe joints ? Ive tried every combination but I just don’t know enough to get to the bottom of it any ideas https://youtu.be/saWmHK4XETI ?? Best Hugo

    HOME | ufencevr

    ufencevr.com

    Chat Conversation End

    Type a message…

  12. "Heres the time codes except you can press them"

    Setup 0:26
    Fixed joint 1:15
    Spring joint 3:33
    Hinge joint 6:54
    Character joint 9:52
    Configurable joint 11:55

Leave a Reply

Your email address will not be published. Required fields are marked *