Giter Club home page Giter Club logo

Comments (12)

JekSun97 avatar JekSun97 commented on August 24, 2024 2

@DiegoSynth I have specially prepared a project for you, please create your problem on it and attach it (this project is for version 4.3)
ProjectBone.zip

Before sending, delete the .godot folder if Github complains about the file size

from godot.

AThousandShips avatar AThousandShips commented on August 24, 2024 1

Please upload an MRP still, it helps a lot and the steps you give are very vague (and it might be difficult to get a good reference skeleton to use as well)

It helps a lot partially because people can just download an MRP and test, it takes much more time to prepare one yourself even with very clear instructions, but it also avoids the risk of someone missing something or not replicating your setup and failing to confirm the issue

from godot.

DiegoSynth avatar DiegoSynth commented on August 24, 2024 1

Alright, I made a Minimum project. It took me 3 hours (created a skeleton, 3d model, skinned it and made a full Godot project from scratch), but here it is.
BugReport.zip

In the example there are two scenes, they both contain the same 3D model with bones.

Scene Body_000 (script attached: Body_000.cs) - contains:
-Model
-BoneAttachment3D
-Area3D
-CollisionShape3D

Scene Body_001 (script attached: Body_001.cs) - contains:
-Model

Both scenes' script inherit from Body.cs which has the main code.
I don't know how I can explain further, but I think it's very clear already, specially launching the project and checking Body.cs, Body_000.cs and Body_001.cs


Edit:
You can easily notice that the GlobalPosition of the BoneAttachment3D created by code (the one on the right: Body_001) is wrong.
Even if you place both models in the same position, the GlobalPosition of the BoneAttachment3D created by code will be different (incorrect). Even if you use only one model scene (and changing the script attached from Body_000 to Body_001 and vice versa).

Please mind that this is an enormous amount of time and work that I'm dedicating for this bug to be taken care of, and I'm very grateful that you are already having a look at it.

Kind regards,
Diego

from godot.

DiegoSynth avatar DiegoSynth commented on August 24, 2024 1

@donpers No work around coming to my mind. I've tried a lot of things with no luck.
I've found that the Transform matrix is different for BoneAttachment3D if created in code vs editor.

transform

There must be something else the editor is doing in the background with the transforms. I believe just adding the BoneAttachment3D to the skeleton by code (addChild) is not enough. But setting the correct Transform3D manually is not solving the issue either (probably it's not refreshing, or who knows what).

I guess our only hope is to wait until someone knowledgeable in the Editor comes to help.

Hey @AThousandShips, any update on this?
@JekSun97 ?

from godot.

AThousandShips avatar AThousandShips commented on August 24, 2024 1

This is the place you get in touch with the developers and contributors, but please don't rush, the info has been filled in, this is the issue case, and issues aren't assigned unless there's some specific issues

Further testing to identify what exactly is causing this is needed by someone who can test the animation code, or find some error in the example and identify what was done wrong to cause this if it isn't a bug but user error

from godot.

DiegoSynth avatar DiegoSynth commented on August 24, 2024

@DiegoSynth I have specially prepared a project for you, please create your problem on it and attach it (this project is for version 4.3) ProjectBone.zip

Before sending, delete the .godot folder if Github complains about the file size

Oh, our replies crossed each other.
Thanks for your help with the sample project; I anyway made a project, I hope it's good, but if anything, please let me know.

from godot.

donpers avatar donpers commented on August 24, 2024

I also noticed this issue half year ago, since then my project is frozen.

In my case i couldnt even tell if there is something i was doing wrong because i find the Mesh button in the tabs menu is very intransparent - and you cant tell what is really happening under the hood and how to properly reproduce it in code.

Any work around ideas?

from godot.

AThousandShips avatar AThousandShips commented on August 24, 2024

No update yet no, no one has looked into this yet as far as I know

from godot.

donpers avatar donpers commented on August 24, 2024

I just noticed your using the mono version of godot, the same bug is happening with the gdscript version.

from godot.

DiegoSynth avatar DiegoSynth commented on August 24, 2024

@donpers Thanks, I've updated the main post. I've previously tested it in 4.1.2 and after migrating I see that it's still the same in 4.2.2.

I wonder if there's any way to reach to any Editor developer / contributor. I could help in the solving process, but if this post stays in stage zero, it will fall into oblivion.

It would be nice if the ticketers could actually fill in the info and create a case/ assign it, as I've very much done my part...

from godot.

DiegoSynth avatar DiegoSynth commented on August 24, 2024

I have figured out the following:

When creating for example this structure:

  • BoneAttachment3D
    • Area3D
      • CollisionShape3D
        • MeshInstance3D

and setting a position delta for the first child of BoneAttachment3D (Area3D), if this delta is calculated before creating (and attaching) the mentioned Nodes, the delta will not have the expected value, whereas if the Nodes are created and attached first, and then the delta is calculated, the delta will be correct:

Bad:

int[] children = this.skeleton.GetBoneChildren(boneId);

// ---------- CALCULATE DELTA POSITION:
vectorBoneGlobal = this.skeleton.ToGlobal(this.skeleton.GetBoneGlobalPose(children[0]).Origin) - this.skeleton.ToGlobal(this.skeleton.GetBoneGlobalPose(boneId).Origin);
position = vectorBoneGlobal / 2f;

// ---------- CREATE AND ATTACH NODES TO SKELETON:
BoneAttachment3D bone = new BoneAttachment3D();
Area3D area = new Area3D();
MeshInstance3D mesh = new MeshInstance3D();
CollisionShape3D collider = new CollisionShape3D();

bone.BoneName = boneName;

skeleton.AddChild(bone);
bone.AddChild(area);
area.AddChild(collider);
collider.AddChild(mesh);

Good:

int[] children = this.skeleton.GetBoneChildren(boneId);

// ---------- CREATE AND ATTACH NODES TO SKELETON:
BoneAttachment3D bone = new BoneAttachment3D();
Area3D area = new Area3D();
MeshInstance3D mesh = new MeshInstance3D();
CollisionShape3D collider = new CollisionShape3D();

bone.BoneName = boneName;

skeleton.AddChild(bone);
bone.AddChild(area);
area.AddChild(collider);
collider.AddChild(mesh);

// ---------- CALCULATE DELTA POSITION:
vectorBoneGlobal = this.skeleton.ToGlobal(this.skeleton.GetBoneGlobalPose(children[0]).Origin) - this.skeleton.ToGlobal(this.skeleton.GetBoneGlobalPose(boneId).Origin);
position = vectorBoneGlobal / 2f;

I don't know if this is "intended" to be like this, or if there's any rational explanation, but this seems to "solve" the issue. I will continue testing it.

from godot.

DiegoSynth avatar DiegoSynth commented on August 24, 2024

Alright, for anyone, in the future; this works:

  1. create ALL bone attachments.
  2. create ALL Area3D, CollisionShape3D, MeshInstance3D, etc.
  3. addChild one to each other, and boneAttachment3D to the skeleton.

AFTER all that structure is done and added to the skeleton (ALL BONE ATTACHMENTS and children nodes):

  1. reposition, resize anything as desired.

This works, so I'm closing this case.

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.