Commit Graph

22 Commits

Author SHA1 Message Date
951ae7b11d Backported from godot4: Add the ability to look-at in model-space.
This is a much simpler attempt to solve the same problem as #76060, but
without breaking any compatibility.

* Adds a description of what model space is in the Vector3 enums
(MODEL_* constants). This has the proper axes laid out for imported 3D
assets.
* Adds the option to `look_at` using model_space, which uses
Vector3.MODEL_FRONT as forward vector.

The attempt of this PR is to still break the assumption that there is a
single direction of forward (which is not the case in Godot)
and make it easier to understand where 3D models are facing, as well as
orienting them via look_at.

- reduz

5fdc1232ef

Also bound the new Basis helper methods.
2024-09-30 17:04:00 +02:00
422314a8fd Added set_look_at helper method to Basis. 2024-09-30 16:41:20 +02:00
010e1b51a8 Added non-static looking_at and from_scale helper methods to Basis. 2024-09-30 16:27:21 +02:00
ee1e40f1b0 Renamed looking_at to create_looking_at, and from_scale to create_from_scale in Basis. 2024-09-30 16:17:19 +02:00
ececc7991c Backported dome of the codestyle improvements to math types from 3fb36bf395 . 2024-04-06 13:05:32 +02:00
337c99e52f File copyright header updates pt1. 2023-12-17 22:29:33 +01:00
7ec207ba27 Fix abs call. 2023-12-10 14:58:37 +01:00
d3f2e0e4fe Fixed SkeletonModification3DFABRIK. 2023-06-22 09:43:55 +02:00
6c9843e5cb Ported: Test, refactor and fix a bug in Basis.get_axis_angle
- fabriceci
9f1a57d48b
2023-06-11 09:45:23 +02:00
lawnjelly
22d90711da Make acos and asin safe
A common bug with using acos and asin is that input outside -1 to 1 range will result in Nan output. This can occur due to floating point error in the input.

The standard solution is to provide safe_acos function with clamped input. For Godot it may make more sense to make the standard functions safe.
2023-06-11 08:41:42 +02:00
0f6fb760ad Now Basis::get_uniform_scale() returns a real_t instead of a float. 2023-05-29 16:08:59 +02:00
47e637b2b8 Mark the parameters of Basis::rotate_to_align as const ref. 2023-05-29 13:03:26 +02:00
9e326c3000 Apparently Basis::rotate_to_align had a bug. Ported the fix by lyuma from: 6dfa6fc50e 2023-05-28 07:26:04 +02:00
6be9bf5dfe Cleaned up and added the skeleton modification stack implementations to the build. Also smaller fixes. 2022-08-18 15:41:28 +02:00
220b2db443 Moved String and related classes under a string folder in core. 2022-08-17 14:19:55 +02:00
d9669b0ed0 Ported form godot4: Reformat structure string operators
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant).
-aaronfranke
554c776e08
2022-08-16 22:46:24 +02:00
170a41ca82 Backported improvements to Basis from Godot4. Also bound all eligible methods. 2022-08-14 00:18:21 +02:00
d9e094ab9a Renamed elements in Basis to rows. 2022-08-13 19:07:59 +02:00
730bce8587 Renamed Quat to Quaternion for consistency with the other engine math classes. 2022-08-13 15:22:33 +02:00
22ce231a4e Backported from Godot 4: New and improved IK system for Skeleton3D
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.
2022-08-10 01:01:38 +02:00
fabriceci
dfd8e09953 Fix the calculation of the angular velocity when the rotation speed is not high.
(cherry picked from commit db7c91e0ada0c91ba48269cf3cc217631ca33bba)
2022-07-29 22:00:03 +02:00
49f8e8c398 Added godot with all my currently used engine modules. 2022-03-15 13:29:32 +01:00