mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 12:26:59 +01:00
Relintai
22ce231a4e
This PR and commit adds a new IK system for 3D with the Skeleton3D node
that adds several new IK solvers, as well as additional changes and functionality
for making bone manipulation in Godot easier.
This work was sponsored by GSoC 2020 and TwistedTwigleg
Full list of changes:
* Adds a SkeletonModification3D resource
* This resource is the base where all IK code is written and executed
* Adds a SkeletonModificationStack3D resource
* This node oversees the execution of the modifications and acts as a bridge of sorts for the modifications to the Skeleton3D node
* Adds SkeletonModification3D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
* Each modification is in it's own file
* Several changes to Skeletons, listed below:
* Added local_pose_override, which acts just like global_pose_override but keeps bone-child relationships intract
* So if you move a bone using local_pose_override, all of the bones that are children will also be moved. This is different than global_pose_override, which only affects the individual bone
* Internally bones keep track of their children. This removes the need of a processing list, makes it possible to update just a few select bones at a time, and makes it easier to traverse down the bone chain
* Additional functions added for converting from world transform to global poses, global poses to local poses, and all the same changes but backwards (local to global, global to world). This makes it much easier to work with bone transforms without needing to think too much about how to convert them.
* New signal added, bone_pose_changed, that can be used to tell if a specific bone changed its transform. Needed for BoneAttachment3D
* Added functions for getting the forward position of a bone
* BoneAttachment3D node refactored heavily
* BoneAttachment3D node is now completely standalone in its functionality.
* This makes the code easier and less interconnected, as well as allowing them to function properly without being direct children of Skeleton3D nodes
* BoneAttachment3D now can be set either using the index or the bone name.
* BoneAttachment3D nodes can now set the bone transform instead of just following it. This is disabled by default for compatibility
* BoneAttachment3D now shows a warning when not configured correctly
* Added rotate_to_align function in Basis
* Added class reference documentation for all changes
- TwistedTwigleg
5ffed49907
Note: It still needs some work.
89 lines
4.4 KiB
XML
89 lines
4.4 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="SkeletonModificationStack3D" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
A resource that holds a stack of [SkeletonModification3D]s.
|
|
</brief_description>
|
|
<description>
|
|
This resource is used by the Skeleton and holds a stack of [SkeletonModification3D]s. The SkeletonModificationStack3D controls the order of the modifications, which controls how they are applied. Modification order is especially important for full-body IK setups, as you need to execute the modifications in the correct order to get the desired results. For example, you want to execute a modification on the spine [i]before[/i] the arms on a humanoid skeleton.
|
|
Additionally, the SkeletonModificationStack3D also controls how strongly the modifications are applied to the [Skeleton3D] node.
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="add_modification">
|
|
<return type="void" />
|
|
<argument index="0" name="modification" type="SkeletonModification3D" />
|
|
<description>
|
|
Adds the passed-in [SkeletonModification3D] to the stack.
|
|
</description>
|
|
</method>
|
|
<method name="delete_modification">
|
|
<return type="void" />
|
|
<argument index="0" name="mod_idx" type="int" />
|
|
<description>
|
|
Deletes the [SkeletonModification3D] at the index position [code]mod_idx[/code], if it exists.
|
|
</description>
|
|
</method>
|
|
<method name="enable_all_modifications">
|
|
<return type="void" />
|
|
<argument index="0" name="enabled" type="bool" />
|
|
<description>
|
|
Enables all [SkeletonModification3D]s in the stack.
|
|
</description>
|
|
</method>
|
|
<method name="execute">
|
|
<return type="void" />
|
|
<argument index="0" name="delta" type="float" />
|
|
<argument index="1" name="execution_mode" type="int" />
|
|
<description>
|
|
Executes all of the [SkeletonModification3D]s in the stack that use the same execution mode as the passed-in [code]execution_mode[/code], starting from index [code]0[/code] to [member modification_count].
|
|
[b]Note:[/b] The order of the modifications can matter depending on the modifications. For example, modifications on a spine should operate before modifications on the arms in order to get proper results.
|
|
</description>
|
|
</method>
|
|
<method name="get_is_setup" qualifiers="const">
|
|
<return type="bool" />
|
|
<description>
|
|
Returns a boolean that indicates whether the modification stack is setup and can execute.
|
|
</description>
|
|
</method>
|
|
<method name="get_modification" qualifiers="const">
|
|
<return type="SkeletonModification3D" />
|
|
<argument index="0" name="mod_idx" type="int" />
|
|
<description>
|
|
Returns the [SkeletonModification3D] at the passed-in index, [code]mod_idx[/code].
|
|
</description>
|
|
</method>
|
|
<method name="get_skeleton" qualifiers="const">
|
|
<return type="Skeleton3D" />
|
|
<description>
|
|
Returns the [Skeleton3D] node that the SkeletonModificationStack3D is bound to.
|
|
</description>
|
|
</method>
|
|
<method name="set_modification">
|
|
<return type="void" />
|
|
<argument index="0" name="mod_idx" type="int" />
|
|
<argument index="1" name="modification" type="SkeletonModification3D" />
|
|
<description>
|
|
Sets the modification at [code]mod_idx[/code] to the passed-in modification, [code]modification[/code].
|
|
</description>
|
|
</method>
|
|
<method name="setup">
|
|
<return type="void" />
|
|
<description>
|
|
Sets up the modification stack so it can execute. This function should be called by [Skeleton3D] and shouldn't be called unless you know what you are doing.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="enabled" type="bool" setter="set_enabled" getter="get_enabled" default="false">
|
|
When true, the modification's in the stack will be called. This is handled automatically through the [Skeleton3D] node.
|
|
</member>
|
|
<member name="modification_count" type="int" setter="set_modification_count" getter="get_modification_count" default="0">
|
|
The amount of modifications in the stack.
|
|
</member>
|
|
<member name="strength" type="float" setter="set_strength" getter="get_strength" default="1.0">
|
|
The interpolation strength of the modifications in stack. A value of [code]0[/code] will make it where the modifications are not applied, a strength of [code]0.5[/code] will be half applied, and a strength of [code]1[/code] will allow the modifications to be fully applied and override the skeleton bone poses.
|
|
</member>
|
|
</members>
|
|
</class>
|