Add optional rot axis / Fix initial pose with rot axis in SpringBone

This commit is contained in:
Silc Lizard (Tokage) Renew
2025-04-29 07:33:01 +09:00
parent 1b37dacc18
commit 9cef0d5ca5
6 changed files with 263 additions and 59 deletions
+46 -3
View File
@@ -226,6 +226,15 @@
Returns the rotation axis at [param joint] in the bone chain's joint list.
</description>
</method>
<method name="get_joint_rotation_axis_vector" qualifiers="const">
<return type="Vector3" />
<param index="0" name="index" type="int" />
<param index="1" name="joint" type="int" />
<description>
Returns the rotation axis vector for the specified joint in the bone chain. This vector represents the axis around which the joint can rotate. It is determined based on the rotation axis set for the joint.
If [method get_joint_rotation_axis] is [constant ROTATION_AXIS_ALL], this method returns [code]Vector3(0, 0, 0)[/code].
</description>
</method>
<method name="get_joint_stiffness" qualifiers="const">
<return type="float" />
<param index="0" name="index" type="int" />
@@ -269,6 +278,14 @@
Returns the rotation axis of the bone chain.
</description>
</method>
<method name="get_rotation_axis_vector" qualifiers="const">
<return type="Vector3" />
<param index="0" name="index" type="int" />
<description>
Returns the rotation axis vector of the bone chain. This vector represents the axis around which the bone chain can rotate. It is determined based on the rotation axis set for the bone chain.
If [method get_rotation_axis] is [constant ROTATION_AXIS_ALL], this method returns [code]Vector3(0, 0, 0)[/code].
</description>
</method>
<method name="get_stiffness" qualifiers="const">
<return type="float" />
<param index="0" name="index" type="int" />
@@ -520,6 +537,19 @@
<param index="2" name="axis" type="int" enum="SpringBoneSimulator3D.RotationAxis" />
<description>
Sets the rotation axis at [param joint] in the bone chain's joint list when [method is_config_individual] is [code]true[/code].
The axes are based on the [method Skeleton3D.get_bone_rest]'s space, if [param axis] is [constant ROTATION_AXIS_CUSTOM], you can specify any axis.
[b]Note:[/b] The rotation axis and the forward vector shouldn't be colinear to avoid unintended rotation since [SpringBoneSimulator3D] does not factor in twisting forces.
</description>
</method>
<method name="set_joint_rotation_axis_vector">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="joint" type="int" />
<param index="2" name="vector" type="Vector3" />
<description>
Sets the rotation axis vector for the specified joint in the bone chain.
This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.
If the vector length is [code]0[/code], it is considered synonymous with [constant ROTATION_AXIS_ALL].
</description>
</method>
<method name="set_joint_stiffness">
@@ -569,9 +599,19 @@
<param index="0" name="index" type="int" />
<param index="1" name="axis" type="int" enum="SpringBoneSimulator3D.RotationAxis" />
<description>
Sets the rotation axis of the bone chain. If sets a specific axis, it acts like a hinge joint.
The value is cached in each joint setting in the joint list.
[b]Note:[/b] The rotation axis and the forward vector shouldn't be colinear to avoid unintended rotation since [SpringBoneSimulator3D] does not factor in twisting forces.
Sets the rotation axis of the bone chain. If set to a specific axis, it acts like a hinge joint. The value is cached in each joint setting in the joint list.
The axes are based on the [method Skeleton3D.get_bone_rest]'s space, if [param axis] is [constant ROTATION_AXIS_CUSTOM], you can specify any axis.
[b]Note:[/b] The rotation axis vector and the forward vector shouldn't be colinear to avoid unintended rotation since [SpringBoneSimulator3D] does not factor in twisting forces.
</description>
</method>
<method name="set_rotation_axis_vector">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="vector" type="Vector3" />
<description>
Sets the rotation axis vector of the bone chain. The value is cached in each joint setting in the joint list.
This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.
If the vector length is [code]0[/code], it is considered synonymous with [constant ROTATION_AXIS_ALL].
</description>
</method>
<method name="set_stiffness">
@@ -647,5 +687,8 @@
<constant name="ROTATION_AXIS_ALL" value="3" enum="RotationAxis">
Enumerated value for the unconstrained rotation.
</constant>
<constant name="ROTATION_AXIS_CUSTOM" value="4" enum="RotationAxis">
Enumerated value for an optional rotation axis. See also [method set_joint_rotation_axis_vector].
</constant>
</constants>
</class>