assimp icon indicating copy to clipboard operation
assimp copied to clipboard

Bug: FBX - Skinned Mesh Imports With Wrong Transforms

Open lxw404 opened this issue 1 year ago • 1 comments

Describe the bug

Currently FBX models with skinned meshes will be imported with invalid transforms due to this change: https://github.com/assimp/assimp/pull/5349 which did not revert this change: https://github.com/assimp/assimp/commit/8a1dc87b4ca.

This results in the pose calculating against invalid absolute transforms.

To Reproduce

Steps to reproduce the behavior: Import a skinned FBX mesh away from the origin of the scene such as this test one: zan.fbx.zip

Expected behavior

The skinned mesh should import without pose distortion.

Screenshots

Blender With Armature

Left Front
blender_InwUAfCIYr blender_2R9L6Ra3pD

Current behavior

Left Front
Resonite_z5ogi1cqZN Resonite_0x4TgoYrX2

Fixed behavior:

Left Front
Resonite_Ch2lVFIbqZ Resonite_2MUYL1UySv

Platform (please complete the following information):

  • Windows 10

Additional context

lxw404 avatar Jun 28 '24 13:06 lxw404

Hmm, that'd definitely be an interesting new shape to add. Looks like it would not be a big change to support it. Which physics engine are you using?

bjorn avatar Jul 10 '19 10:07 bjorn

im creating my own.. and that example came from Unity tutorial..

justgook avatar Jul 10 '19 12:07 justgook

So I guess this shape is not commonly supported by collision engines, but it could still be generally useful since it can be easily converted to two circles and a rectangle or a polygon if needed.

Would you like to have a go at adding this?

bjorn avatar Jul 10 '19 14:07 bjorn

im not really good in C++ stuff.. so not really have clue how / where to add / make PR.. but that is kind of base shape for most of game engines, to represent characters.. and that also have lot of examples in 3d,

justgook avatar Jul 10 '19 15:07 justgook

For physics engines used in games, this is a actually a very common shape, and would be great to have in Tiled! It's commonly used for player objects or any other objects that does not fit a square shape. Square shapes and collisions tend to be a bit tricky to handle smoothly using physics engines, which is why circles and capsules are commonly used for moving objects.

SSBMTonberry avatar Jul 12 '19 12:07 SSBMTonberry

@SSBMTonberry Right, but at the same time I don't know about any (2D) physics engine that specifically supports capsules. Chipmunk2D has circles, lines and polygons. Box2D (and hence planck.js) do convex polygons and circles (lines as well), Matter.js supports polygons and circles. I haven't yet found a library that does capsules.

So, it appears to me that a capsule will generally need to be modeled with either a polygon or combination of a box and two circles. And in that case I don't see a big advantage of having a capsule directly supported in Tiled. But in any case I'm certainly not opposed to adding it.

Maybe I can help you getting started with the C++ part, @justgook. There's a wiki page about Contributing to Tiled that's meant to guide you through setting up your development environment.

bjorn avatar Jul 12 '19 15:07 bjorn

Erm, alright, you mentioned a Unity tutorial, but in fact your example comes from the Unity 2D physics engine, which apparently does support capsules. So we've found a pretty significant one. :-)

bjorn avatar Jul 12 '19 15:07 bjorn

@bjorn : Capsules are usually made by combining a box and two circles, like you say. I'm using a collision detection library called cute_c2, which is a single header library. It supports capsules directly. For both Box2D and Chipmunk I think the most common way of producing capsules is by combining two circles and a box, which a capsule is made of anyways.

SSBMTonberry avatar Jul 12 '19 15:07 SSBMTonberry

Small request if this is added to Tiled: Please point me to the parametric equation used to approximate the shape of these capsules. I will add that to SuperTiled2Unity. Thanks!

Seanba avatar Jul 12 '19 16:07 Seanba

@Seanba Hmm, what do you need that for? I'm not sure what such an equation would look like. Why not use two circles and a box to model the exact shape?

bjorn avatar Jul 12 '19 20:07 bjorn

@bjorn Under some conditions I have to approximate all shape types as polygons. I figured I would piggy back on whatever you use for displaying the outline of a capsule shape but I've got other ways to get what I need through the Clipper library if need be. :)

Seanba avatar Jul 12 '19 21:07 Seanba

In Chipmunk2D, segments have a "radius", essentially making them capsules.

TheRealOrangus avatar Jul 23 '19 18:07 TheRealOrangus

Godot the game engine also uses capsules, as well as Rapier.

jrasanen avatar Oct 30 '22 08:10 jrasanen

It would be nice to see capsules implemented for added Godot support!

CurryOnRice avatar Jun 02 '24 11:06 CurryOnRice