.. _stdlib_sixDof_joint_component: =========== SixDofJoint =========== This component creates a six-degrees-of-freedom joint. It is the most configurable joint. It can simulate any other joint, and more. Two objects, ``node0`` and ``node1``, can be constrained along any translation or rotation axis. For example, this joint can be used to make ragdolls. The joint can be added as a component to either one of the two bodies, or to a new entity with a single joint component—the behavior of the joint will be the same. Only one joint can be added to a single node. This component is provided by the ``engine.physics_core`` module, which is included in the ``engine.core`` module. Example:: require engine.core // Create first body let nodeA = create_node(NodeData(position = float3(0, 10, 10), scale = float3(1, 1, 10))) add_component(nodeA, new RigidBody()) add_component(nodeA, new BoxCollider()) // Create second body let nodeB = create_node(NodeData(position = float3(0, 10, -10), scale = float3(1, 1, 10))) add_component(nodeB, new RigidBody()) add_component(nodeB, new BoxCollider()) // Create a joint that keeps two bodies at the distance they were created at — 20 add_component(create_node(NodeData(position = float3(0, 10, 0))), new SixDofJoint( node0 = nodeA, node1 = nodeB, // allow some movement along the X and Z axes, but not along the Y axis limitTranslation = float3(2, 0, 2), // allow some rotation around the Y and Z axes, but not around the X axis limitRotation = float3(0.0, PI / 4., PI / 4.) )) +++++++ Classes +++++++ .. _struct-sixDof_joint_component-SixDofJoint: .. das:attribute:: SixDofJoint : NativeComponent The most configurable physics joint. It can also be used to simulate other joints. :Properties: .. _function-sixDof_joint_component__dot__rq_node0_SixDofJoint: .. das:operator:: SixDofJoint.node0() : NodeId .. _function-sixDof_joint_component__dot__rq_node0_rq_clone_SixDofJoint_NodeId: .. das:operator:: SixDofJoint.node0 =(value: NodeId) A first body of the joint. It should have an active RigidBody component. :Arguments: * **value** : :ref:`NodeId ` .. _function-sixDof_joint_component__dot__rq_node1_SixDofJoint: .. das:operator:: SixDofJoint.node1() : NodeId .. _function-sixDof_joint_component__dot__rq_node1_rq_clone_SixDofJoint_NodeId: .. das:operator:: SixDofJoint.node1 =(value: NodeId) A second body of the joint. It should have an active RigidBody component. :Arguments: * **value** : :ref:`NodeId ` .. _function-sixDof_joint_component__dot__rq_allowCollision_SixDofJoint: .. das:operator:: SixDofJoint.allowCollision() : bool .. _function-sixDof_joint_component__dot__rq_allowCollision_rq_clone_SixDofJoint_bool: .. das:operator:: SixDofJoint.allowCollision =(value: bool) Used for disabling collision between the joined bodies. Default is false, disables collision. :Arguments: * **value** : bool .. _function-sixDof_joint_component__dot__rq_limitTranslation_SixDofJoint: .. das:operator:: SixDofJoint.limitTranslation() : float3 .. _function-sixDof_joint_component__dot__rq_limitTranslation_rq_clone_SixDofJoint_float3: .. das:operator:: SixDofJoint.limitTranslation =(value: float3) Allowed offset from the starting position by every axis. Set an axis to zero to prevent translation by this axis. Set it to FLT_MAX or any negative value to disable any constraints for this axis. :Arguments: * **value** : float3 .. _function-sixDof_joint_component__dot__rq_limitRotation_SixDofJoint: .. das:operator:: SixDofJoint.limitRotation() : float3 .. _function-sixDof_joint_component__dot__rq_limitRotation_rq_clone_SixDofJoint_float3: .. das:operator:: SixDofJoint.limitRotation =(value: float3) Allowed rotation around axes. Set an axis to zero to prevent rotation around this axis. Set it to ``PI * 2`` or any negative value to disable any constraints for this axis. :Arguments: * **value** : float3 .. _function-sixDof_joint_component__dot__rq_friction_SixDofJoint: .. das:operator:: SixDofJoint.friction() : float .. _function-sixDof_joint_component__dot__rq_friction_rq_clone_SixDofJoint_float: .. das:operator:: SixDofJoint.friction =(value: float) Maximum friction force :Arguments: * **value** : float .. _function-sixDof_joint_component__dot__rq_frictionTorque_SixDofJoint: .. das:operator:: SixDofJoint.frictionTorque() : float .. _function-sixDof_joint_component__dot__rq_frictionTorque_rq_clone_SixDofJoint_float: .. das:operator:: SixDofJoint.frictionTorque =(value: float) Maximum amount of torque to apply as friction :Arguments: * **value** : float .. _function-sixDof_joint_component__dot__rq_softTranslationLimit_SixDofJoint: .. das:operator:: SixDofJoint.softTranslationLimit() : float2 .. _function-sixDof_joint_component__dot__rq_softTranslationLimit_rq_clone_SixDofJoint_float2: .. das:operator:: SixDofJoint.softTranslationLimit =(value: float2) Soft limit for translation. When one of the bodies tries to move out of allowed offsets, the soft limits can pull it with a spring force. The spring settings are packed to float2 where ``x`` is a spring frequency in Hz, and ``y`` is a spring damping (0 = no damping, 1 = critical damping, >1 = overdamp). If frequency = 0, the soft limit is disabled and the constraint will have hard limits. :Arguments: * **value** : float2