New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions about joints #15
Comments
I've been asked to add breakables and motors to joints, so will be looking closely at the joints this week and I'll tighten up the language, units, etc. as you suggest. Just to address your philosophical questions, though: I'm not terribly pushed about how the axes are represented. The current 1/2/3 just seemed simplest to us, as they correspond to the columns of your constraint space transform. Having arrays feels a little more flexible and future-proof; I imagine a joint extension which would want to express linkages between different axes which could be used to make some more exotic linkages like a rack-and-pinion (but have not thought through all the possible details here.) The reason the axes are specified as minItems=1, maxItems=3, is that the jointLimit (of which, there can be multiple per joint) specifies I didn't realize "Infinity" was explicitly forbidden by RFC-4627 (silly assumption on my part) - that's a bit of a pain, unfortunately, as infinity is also useful for inertia tensors - probably means that we'd need to store those values as the reciprocal of what they currently are, so that a value of 0 could represent infinity. As for the pivots, the way Blender and Godot show constraints in the UI is a simplification of what's happening under the hood - they both use a single pivot in world space to represent the constraint, which means that when you're authoring content, they assume that the constraint pivots in both bodies are aligned at authoring time, which isn't necessarily the case (Unity doesn't have this property -- in their Joint object, there's fields for specifying the constraint space in each of the connected nodes.) In order to not lose information when doing a "load->simulate/modify->save" you really do need two pivots and those pivots should be children of the simulated nodes in order to ensure that the constraint space is consistent when a parent or the pivot is transformed, either by the simulation, user repositioning node or an animation repositioning the nodes. Where those pivots are in the scene tree doesn't really matter, but obviously, the joint can only have an affect if at least one of the pivots is associated with an object which can move. Right now, the way the constraint space is specified is that the |
EDIT: I misunderstood the spec, since then Eoin has updated the spec and explained it to me better. I'm collapsing what I wrote before. I will write some further text on this topic in the near future. @eoineoineoin You are right that where the pivots are in the scene tree does not really matter. However, the initial position of the joint does matter, because it determines where the jointed position is relative to each of the jointed nodes. The above image shows the initial conditions of an example. A pin joint is a type of joint that constraints all linear axes and none of the angular axes. If I put the pin joint node at the right of the pole, the cube swings like this: Godot.-.JointTest.DEBUG.-.9.March.2023.mp4If instead I put the pin joint in the center of the pole, the cube swings like this:~~ Godot.-.JointTest.DEBUG.-.9.March.2023.1.mp4
Note that Godot does not have breakables, so the spec should define what should happen in this case. Is it acceptable for a breakable joint to not be breakable if the physics engine does not support breakable joints? |
Hi Aarron, I think you've misinterpreted some part of the doc - if you can point to a particular part that was confusing, I'll be happy to fix it up, but otherwise, will take a holistic view of the docs. The I made a quick demo for you; can't attach a file to this issue, so don't have a better place to put this file right now, I have just uploaded it to my personal site: http://eoinrul.es/AaronConstraintDemo.gltf You can simply drag-and-drop this file into my Godot importer and you'll get both the configurations you were highlighting. You'll also note that the joint is attached to the static bodies: Peek.2023-03-15.09-06.mp4
|
https://github.com/eoineoineoin/glTF_Physics/tree/master/RigidBodies#joints
linearAxes
andangularAxes
, their type is described asinteger[1..3]
. Shouldn't the range be[0..3]
, so that you can define a joint constraint only for linear or only for angular? Right now, if a joint constraint is required to have at least 1 item in each array, then a constraint must constrain both linearly and angularly.ForlinearAxes
andangularAxes
, should we use a bitmask instead of an array of numbers? For example, 0 would be none, 1 would be X, 2 would be Y, 4 would be Z, therefore 3 would be X and Y, and 7 would be X, Y, and Z. This would be a more compact representation, both in memory and in the data required to store it.ForlinearAxes
andangularAxes
, should we use strings "X", "Y", and "Z" instead of the numbers 0, 1, 2? If we want to improve readability by having different members for each axis, we could name them explicitly.springConstant
? Is this the same as stiffness? https://en.wikipedia.org/wiki/Stiffness If so then it would beN/m
orkg/s²
. Should we rename it to "stiffness" or "springStiffness" to better clarify what constant we are referring to? See also the Wikipedia page on Hooke's Law: https://en.wikipedia.org/wiki/Hooke%27s_law "k is a constant factor characteristic of the spring (i.e., its stiffness)"springConstant
/ stiffness, Godot has a property for this (incorrectly named "softness" where larger values are harder), but it does not take into account the mass of objects (so a 1kg object would spring the same if it were 100kg, and therefore Godot's property applies acceleration and has a unit of/s²
). Should we define that it should? If so, the Godot importer will need to adjust this property according to the mass.springConstant
work? It's not possible to set a default value of infinity inside of a JSON spec. Should we set it to a really high number instead? Or do we set it to the string "Infinity" and hope that no spec parsers explode trying to coerce that into a number?springDamping
? What is its default value? Godot has a damping property, but I don't know how to validate if it behaves the same way as what is being defined in this spec."at least one of the connected nodes or its ancestors should have rigidBody properties" Why allow connecting a child of a body, why not just always require a connected body to be connected directly?How can you have a joint between a rigid body and a static body? Is it by joining to a node without a rigid body? Godot's joints only allow a body to be connected, or null to join to a fixed point in world space. However, joining to a fixed point in world space is not a good idea if we want glTF files to be instanced away from the origin. Otherwise, I guess we could just join to a kinematic body, and not move that body, but it would be clearer to have a static body type to join to. Anyway, the spec should define how to do this.In my opinion, physics joints should be separate nodes referencing two rigid bodies, not part of a rigid body referencing another. This is more intuitive to work with since it's easy to visualize where the joint is, and it's simpler since you don't need custom constraints with different offsets for each joint. This is also how Godot, Blender, and Unreal work, and is more like how real life works.Do you have any example files that contain joints, or any implementations that support joints?The text was updated successfully, but these errors were encountered: