godotengine / godotengine/godot

SkeletonIK chain solver operates differently in GDExtension and C++ Module

Open
#91,061 6 comments 0 reactions 0 assignees View on GitHub
needs testing topic:3d topic:animation
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Tested 4.2.2

### System information

Linux, x86_64, Kubuntu 22.04, Godot 4.2.2 custom build

### Issue description

I decided to port my C++ extension into a C++ module. I discovered a discrepancy between the two versions and thought I would mention it. When mapping bones between the two versions their orientation is reversed.

### Steps to reproduce

When SkeletonIK3D is in a C++ extension.
```
Vector3 forward_vector = (ci->initial_transform.get_origin() - ci->children[0].initial_transform.get_origin()) .normalized();
```
In a Module, and as it is in the engine's version.
```
Vector3 forward_vector = (ci->children[0].initial_transform.get_origin() - ci->initial_transform.get_origin()) .normalized();
```
The origins swap positions.

### Minimal reproduction project (MRP)

Being a C++ project it is a bit unwieldy to create a small project with this, but I thought I would highlight the discrepancy. I have versions working as a Module and Extension. I just don't think there should be a difference between the versions.

Contributor guide

Open the contributing guide

Research direction

Start at the SkeletonIK3D chain solver and compare the shown forward_vector calculation in the C++ extension and C++ module versions. Reproduce the orientation difference using the reporter's two implementations and trace why the bone origins are swapped. Done means both versions produce the same bone orientation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.