mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-27 14:17:37 +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.
67 lines
3.4 KiB
XML
67 lines
3.4 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="SkeletonModification3D" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
A resource that operates on bones in a [Skeleton3D].
|
|
</brief_description>
|
|
<description>
|
|
This resource provides an interface that can be expanded so code that operates on bones in a [Skeleton3D] can be mixed and matched together to create complex interactions.
|
|
This is used to provide Godot with a flexible and powerful Inverse Kinematics solution that can be adapted for many different uses.
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="_execute" qualifiers="virtual">
|
|
<return type="void" />
|
|
<argument index="0" name="delta" type="float" />
|
|
<description>
|
|
Executes the given modification. This is where the modification performs whatever function it is designed to do.
|
|
</description>
|
|
</method>
|
|
<method name="_setup_modification" qualifiers="virtual">
|
|
<return type="void" />
|
|
<argument index="0" name="modification_stack" type="SkeletonModificationStack3D" />
|
|
<description>
|
|
Sets up the modification so it can be executed. This function should be called automatically by the [SkeletonModificationStack3D] containing this modification.
|
|
If you need to initialize a modification before use, this is the place to do it!
|
|
</description>
|
|
</method>
|
|
<method name="clamp_angle">
|
|
<return type="float" />
|
|
<argument index="0" name="angle" type="float" />
|
|
<argument index="1" name="min" type="float" />
|
|
<argument index="2" name="max" type="float" />
|
|
<argument index="3" name="invert" type="bool" />
|
|
<description>
|
|
Takes a angle and clamps it so it is within the passed-in [code]min[/code] and [code]max[/code] range. [code]invert[/code] will inversely clamp the angle, clamping it to the range outside of the given bounds.
|
|
</description>
|
|
</method>
|
|
<method name="get_is_setup" qualifiers="const">
|
|
<return type="bool" />
|
|
<description>
|
|
Returns whether this modification has been successfully setup or not.
|
|
</description>
|
|
</method>
|
|
<method name="get_modification_stack">
|
|
<return type="SkeletonModificationStack3D" />
|
|
<description>
|
|
Returns the [SkeletonModificationStack3D] that this modification is bound to. Through the modification stack, you can access the Skeleton3D the modification is operating on.
|
|
</description>
|
|
</method>
|
|
<method name="set_is_setup">
|
|
<return type="void" />
|
|
<argument index="0" name="is_setup" type="bool" />
|
|
<description>
|
|
Manually allows you to set the setup state of the modification. This function should only rarely be used, as the [SkeletonModificationStack3D] the modification is bound to should handle setting the modification up.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="enabled" type="bool" setter="set_enabled" getter="get_enabled" default="true">
|
|
When true, the modification's [method _execute] function will be called by the [SkeletonModificationStack3D].
|
|
</member>
|
|
<member name="execution_mode" type="int" setter="set_execution_mode" getter="get_execution_mode" default="0">
|
|
The execution mode for the modification. This tells the modification stack when to execute the modification. Some modifications have settings that are only available in certain execution modes.
|
|
</member>
|
|
</members>
|
|
</class>
|