Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converter generates incorrect rotation key frames #108

Open
pjcozzi opened this issue Dec 23, 2017 · 5 comments
Open

Converter generates incorrect rotation key frames #108

pjcozzi opened this issue Dec 23, 2017 · 5 comments
Labels

Comments

@pjcozzi
Copy link
Member

pjcozzi commented Dec 23, 2017

Replaces KhronosGroup/glTF#244


A COLLADA model with the following animation (hand edited at this point) has five keyframes:

        <animation id="Geometry-mesh097_rotation098Z.ANGLE">
            <source id="Geometry-mesh097_rotation098Z.ANGLE-input">
                <float_array id="Geometry-mesh097_rotation098Z.ANGLE-input-array" count="5">0 0.5 1.0 1.5 2.0</float_array>
                <technique_common>
                    <accessor count="5" source="#Geometry-mesh097_rotation098Z.ANGLE-input-array" stride="1">
                        <param name="TIME" type="float" />
                    </accessor>
                </technique_common>
            </source>
            <source id="Geometry-mesh097_rotation098Z.ANGLE-output">
                <float_array id="Geometry-mesh097_rotation098Z.ANGLE-output-array" count="5">0 90 180 270 360</float_array>
                <technique_common>
                    <accessor count="5" source="#Geometry-mesh097_rotation098Z.ANGLE-output-array" stride="1">
                        <param name="ANGLE" type="float" />
                    </accessor>
                </technique_common>
            </source>
            <source id="Geometry-mesh097_rotation098Z.ANGLE-interpolations">
                <Name_array id="Geometry-mesh097_rotation098Z.ANGLE-interpolations-array" count="5">LINEAR LINEAR LINEAR LINEAR LINEAR</Name_array>
                <technique_common>
                    <accessor count="5" source="#Geometry-mesh097_rotation098Z.ANGLE-interpolations-array" stride="1">
                        <param name="INTERPOLATION" type="Name" />
                    </accessor>
                </technique_common>
            </source>
            <sampler id="Geometry-mesh097_rotation098Z.ANGLE-sampler">
                <input semantic="INPUT" source="#Geometry-mesh097_rotation098Z.ANGLE-input" />
                <input semantic="OUTPUT" source="#Geometry-mesh097_rotation098Z.ANGLE-output" />
                <input semantic="INTERPOLATION" source="#Geometry-mesh097_rotation098Z.ANGLE-interpolations" />
            </sampler>
            <channel source="#Geometry-mesh097_rotation098Z.ANGLE-sampler" target="Geometry-mesh097Node/rotation098Z.ANGLE" />
        </animation>

The rotation angles around Z are simply 0 90 180 270 360. However, the converter generates the following axis-angle rotations, which include an axis flip:

[1, 0, 0, 0]
[0, 0, 1, 1.5707963705062866]
[0, 0, 1, 3.1415927410125732]
[0, 0, -1, 1.5707963705062866]
[0, 0, -1, 0]

Adding more keyframes (with shorter deltas between the rotation angles) does not fix the problem nor does changing the domain from [0, 360] to [-180, 180].

@rck1
Copy link

rck1 commented Feb 14, 2018

I noticed the same issue. I am converting from Maya to COLLADA (using the OpenCollada plugin) and then using Collada2GLTF to convert the gltf. I get the axis flip issue on animations as well, i.e. rotations about the y-axis converts to rotations about the x-axis. Will there be a fix soon? Is there any work arounds in the meantime?

@lasalvavida
Copy link
Contributor

@rck1, are you using the 2.0 branch?

@rck1
Copy link

rck1 commented Feb 15, 2018

@lasalvavida, I am using the pre-built binaries from the latest release (v2.0).

@lasalvavida
Copy link
Contributor

@rck1, can you attach the model that isn't converting correctly here?

@rck1
Copy link

rck1 commented Feb 15, 2018

@lasalvavida, I won't be able to attach the model that I'm using at work but I'll see if I can replicate it at home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants