This would be perfect for doors in my 3D game. Static body for the door frame, rigid body for the door, and a hinge joint that handles opening and closing.
I actually did this but I keep having an issue with rigid bodied in general were at a random point shortly after I have started my game it gets harder and harder to push for example the door around until it just becomes impossible. It's almost like the rigid body just keeps accelerating downwards until it ends up having so much inertia that my puny pill character has no chance of moving it. Any o' yall ever experienced anything like that?
Niice! And maybe, if you want it to be more "door like", it can essentially be disabled unless a character / object hits it at a certain speed, in which case it will "enable" the crazy free-swinging :D.
@1:55 "You'll also see these other options for Bias, Softness, and Relaxation..." From the Godot Docs we get some of (but not all) the answers. Bias: "The speed with which the rotation across the axis perpendicular to the hinge gets corrected. " Softness: "There is currently no description for this property. Please help us by contributing one! " Relaxation: "The lower this value, the more the rotation gets slowed down. " Well, we got 2 out of 3 at least. --- Also, the KinematicBody doesn't move because we the developers are expected to apply our own forces to the KinematicBody using either the *move_and_slide()* or *move_and_slide_with_snap()* functions. If I set the *infinite_mass* parameter of either *move_and_slide()* to false then I can push a KinematicBody that isn't moving (i.e. directly apply force through game physics), but if I use the hinge joint then I can't indirectly use it to apply force. Odd, but that's the way things seem to work. Usually though for a KinematicBody force is applied via the first parameter of either *move_and_slide()* function.
Thanks very much. In my previous 2D prototype, I made swinging platforms using 2 hand-made animations (one of them is a mirrored version of the other) that play depending on where the player touches the platform. For the style of game that this prototype was (A 2D autorunner with a fixed player speed), this is surprisingly realistic, but required hard work and a little bit of frustration to pull off. Now i can do this much easier and much more versatile AND much more convincingly with PHYSICS!, and this makes me go "yes"
note kinematic (or rigid bodies in kinematic mode) are essentially static, that is they collide but are not subject to forces, the only difference is the physics engine expects kinematic bodies to move under software control
@@garbaj you are very welcome. i am fooling around with bullet physics currently. have some fun with a kinematic (that you control) attached to the joint of your choice to a regular rigid body. the 6dof with spring forces (tuned stiffness and damp if you know basic spring physics) make for an interesting way to nudge rigid bodies around
@@unknow3238 Just for reference, you can set a Rigid body to act as a KinematicBody or a static body. very flexible! docs.godotengine.org/en/stable/classes/class_rigidbody.html
"Can't use it with a kinematic body because they don't interact at all." Dang, there goes me trying to use it to cheese a mouse-controlled swiveling 3rd person camera without trying to figure out trigonometry in script. X_X lol EDIT: This would be absolutely perfect for a clock-work platformer level!
The 'other numbers' are for if the 'static' body is moving very fast, how rigidly does the hinge follow. You'd be surprised that it's not instant and it's like a spring. this is because one is moved 'outside' of physics, and the physics has to 'catch up' and it doesn't do it 'instantly' because that's not physically possible, so it has to move from one place to another, and it gets momentum, etc.
Could you do the other joints? I tried to join a small box to the rigidbody with a spring. I thought it might bounce and swing around as the rigidbody moved. However, the two boxes acted like one box. Knowing how the spring part 6DOF joint works would be very useful for me. Thank you.
@@garbaj I know, but the rigid body moves/rotates like it's anchored to the (invisible) hinge rather than the static body, making me wonder if I could simply replace the static body with an empty 3d-Spatial . Or another rigid body and see if they both rotate around the hinge, or ... well I got to wait till I get home from work :)
Hi! Good video! Coul you make an other demonstration about the other types of joints? Is there a way to join 2 objects with some joint node, and if i apply too much force, they get separated? Edit: Can i do it with simple pin joint?
@@sosasees Yep. But there are a lot of differences between these. Example, with the HingeJoint you can put a limit in how much can the joint rotate in an angle, Pin Joint no, this is a very useful function.
Just like referencing any object in godot. If it's a node in your scene you can get it and it's properties. Ex: 1. "onready" the node inside your script 2. use the "onready" variable you made to change it's properties. "hinge3d.node_a = ???" Hover over words inside the ui in Godot. It will tell you which *property to use; *[Property: node_a].
This would be perfect for doors in my 3D game. Static body for the door frame, rigid body for the door, and a hinge joint that handles opening and closing.
That's a clever idea!
It much better than using animations for door opening and closing
I actually did this but I keep having an issue with rigid bodied in general were at a random point shortly after I have started my game it gets harder and harder to push for example the door around until it just becomes impossible. It's almost like the rigid body just keeps accelerating downwards until it ends up having so much inertia that my puny pill character has no chance of moving it. Any o' yall ever experienced anything like that?
Niice! And maybe, if you want it to be more "door like", it can essentially be disabled unless a character / object hits it at a certain speed, in which case it will "enable" the crazy free-swinging :D.
lmao
@1:55 "You'll also see these other options for Bias, Softness, and Relaxation..."
From the Godot Docs we get some of (but not all) the answers.
Bias:
"The speed with which the rotation across the axis perpendicular to the hinge gets corrected.
"
Softness:
"There is currently no description for this property. Please help us by contributing one!
"
Relaxation:
"The lower this value, the more the rotation gets slowed down.
"
Well, we got 2 out of 3 at least.
---
Also, the KinematicBody doesn't move because we the developers are expected to apply our own forces to the KinematicBody using either the *move_and_slide()* or *move_and_slide_with_snap()* functions.
If I set the *infinite_mass* parameter of either *move_and_slide()* to false then I can push a KinematicBody that isn't moving (i.e. directly apply force through game physics), but if I use the hinge joint then I can't indirectly use it to apply force. Odd, but that's the way things seem to work.
Usually though for a KinematicBody force is applied via the first parameter of either *move_and_slide()* function.
Thanks for the info
Now I can add a fur dice to my car.
This is it. All other uses for this node are banned
Or...(Don't hate me)...truck nuts. :|
Duuude, this will be so useful in my game!! Thanks garbaj!
You're welcome!
Now, Garbaj can make a garbage can with a foot peddle activated lid. It's cosmic balance.
perfectly balanced
@@garbaj don't have to be Spiffing to appreciate balance; totes agree!
yohooo… you're the best!!! keep more coming... we're following and building great games
Thanks for your support!
Thank you for sharing this! This has given me a ton of ideas for a possible grappling hook that I could implement.
Glad to hear it!
Thanks very much.
In my previous 2D prototype, I made swinging platforms using 2 hand-made animations (one of them is a mirrored version of the other) that play depending on where the player touches the platform.
For the style of game that this prototype was (A 2D autorunner with a fixed player speed), this is surprisingly realistic, but required hard work and a little bit of frustration to pull off.
Now i can do this much easier and much more versatile AND much more convincingly with PHYSICS!, and this makes me go "yes"
If only we had this thing in 2D. I don't understand why there is no way to make a motor in 2D, it's crazy.
same
this could be used for swinging in games like spooderman
Yep, that was my first thought when I learned about this node
note kinematic (or rigid bodies in kinematic mode) are essentially static, that is they collide but are not subject to forces, the only difference is the physics engine expects kinematic bodies to move under software control
Ahh, thanks!
@@garbaj you are very welcome. i am fooling around with bullet physics currently. have some fun with a kinematic (that you control) attached to the joint of your choice to a regular rigid body. the 6dof with spring forces (tuned stiffness and damp if you know basic spring physics) make for an interesting way to nudge rigid bodies around
Thank you, but can you do a tutorial on a swing grapple hook; like spider-man's kinda.
This video gives you 50% of what you need to know ;)
@@garbaj now, just have to figure out how to make a character mouvement as good as the kinematic one, but with rigidbody ! :P
@@unknow3238 Just for reference, you can set a Rigid body to act as a KinematicBody or a static body. very flexible! docs.godotengine.org/en/stable/classes/class_rigidbody.html
thank you once again for this thing, I had no idea it existed !!
No problem!
pretty much just like ballsockets and rigid ropes in gmod. awesome!
Thank you! This _video_ was insanely useful!!
"Can't use it with a kinematic body because they don't interact at all."
Dang, there goes me trying to use it to cheese a mouse-controlled swiveling 3rd person camera without trying to figure out trigonometry in script. X_X lol
EDIT: This would be absolutely perfect for a clock-work platformer level!
is motor in radients or in degrees? does it use delta or not? im confused.
Awesome content!!
Appreciate it!
now i can make a grapple gun TYYYYYY!
Great for orbiting too!
Thank you, great videos!
this is SO useful. Didn;t know about this..
Combined with the animation player, this could make for fun traps like swinging axes.
The 'other numbers' are for if the 'static' body is moving very fast, how rigidly does the hinge follow. You'd be surprised that it's not instant and it's like a spring. this is because one is moved 'outside' of physics, and the physics has to 'catch up' and it doesn't do it 'instantly' because that's not physically possible, so it has to move from one place to another, and it gets momentum, etc.
If I have a door, how can I make it that character body dont push it away?
Very informative, first time I see that.
Glad you found the video informative
Could you do the other joints? I tried to join a small box to the rigidbody with a spring. I thought it might bounce and swing around as the rigidbody moved. However, the two boxes acted like one box. Knowing how the spring part 6DOF joint works would be very useful for me. Thank you.
here you learn from the master
I'm not sure if I'll ever use this idea,
but I just came up with attaching a rope to a wooden mouse cursor.
What is the static body in this set-up good for? Just to stop the other body? seems like I'm missing out something. I'll go experiment a bit.
The static body is just an anchor point for the hinge. It doesn't move
@@garbaj I know, but the rigid body moves/rotates like it's anchored to the (invisible) hinge rather than the static body, making me wonder if I could simply replace the static body with an empty 3d-Spatial . Or another rigid body and see if they both rotate around the hinge, or ... well I got to wait till I get home from work :)
Yes, you can have both ends be connected to rigidbodies
Hi!
Good video! Coul you make an other demonstration about the other types of joints?
Is there a way to join 2 objects with some joint node, and if i apply too much force, they get separated?
Edit: Can i do it with simple pin joint?
I don't know off the top of my head how to implement something like you're talking about, but I think it can definitely be done.
Unfortunately, godot dont have a 2D Hinge Joint
I found PinJoint2D.
In 2D, the Hinge and Pin Joints would be exactly the same
since both could Only rotate around 1 possible axis (Z).
@@sosasees Yep. But there are a lot of differences between these. Example, with the HingeJoint you can put a limit in how much can the joint rotate in an angle, Pin Joint no, this is a very useful function.
This is fantastic!!!
plz make a tutorial on fixedJoint for godot
first idea i had was making a clock
then a door
I accidentally discovered that Godot has joints when i was searching "grid" to add a gridmap
Can you attach something to the Node A and Node B of a joint, my GDscript instead of assigning them manually?
Just like referencing any object in godot. If it's a node in your scene you can get it and it's properties.
Ex:
1. "onready" the node inside your script
2. use the "onready" variable you made to change it's properties. "hinge3d.node_a = ???"
Hover over words inside the ui in Godot. It will tell you which *property to use; *[Property: node_a].
Can we use the same knowledge to simulate doors ?
yes
So the pin joint is more like a rope? Whereas the hinge joint is like having something stuck into the object rotating it around
hinge joints rotate on a single axis, kind of like a door hinge. Pin joints can rotate freely in all directions
Garbaj can you make a video about healthbar
Two words: Grapple. Hook.
Nice but I didn't finde a Hinge Joint Node 2D
Yes, Hinge Joint is 3d only
I found PinJoint2D.
In 2D, the Hinge and Pin Joints would be exactly the same
since both could Only rotate around 1 possible axis (Z).
How can Disconnect and Connect a coneTwistJoint via Script? Truck_Town in godot-Demo has a coneTwistJoint
Godot joint glitch when over limit, try so many way but no one works perfect.
Do u have patreon or something ? I'd love to give u atleast something for your awesome Content!
Not yet, but I haven’t ruled it out
Interesting ...
cool
cool
Doesn’t exist for 2D.
That is correct
I found PinJoint2D.
In 2D, the Hinge and Pin Joints would be exactly the same
since both could Only rotate around 1 possible axis (Z).