Skip to content

Silk.NET.Assimp Quaternions are incorrect #796

Description

@Kermalis

Summary

Upon parsing Quaternions from NodeAnim*, I was stumbling upon incorrect Quaternions. The aiQuaterniont struct puts W first, but System.Numerics.Quaternion is X first. So it appears Silk.NET is casting those aiQuaternionT* to System.Numerics.Quaternion or something, which results in W being at X which is wrong.

Here's my workaround for parsing them:

NodeAnim*chan=a->MChannels[j];varpositions=new(float,Vector3)[chan->MNumPositionKeys];for(intk=0;k<positions.Length;k++){VectorKeypos=chan->MPositionKeys[k];positions[k]=((float)pos.MTime,pos.MValue);}varrotations=new(float,Quaternion)[chan->MNumRotationKeys];for(intk=0;k<rotations.Length;k++){QuatKeyrot=chan->MRotationKeys[k];rotations[k]=((float)rot.MTime,newQuaternion(rot.MValue.Y,rot.MValue.Z,rot.MValue.W,rot.MValue.X));// HERE: Incorrectly casted by library, so order is shifted by one field}varscales=new(float,Vector3)[chan->MNumScalingKeys];for(intk=0;k<scales.Length;k++){VectorKeyscl=chan->MScalingKeys[k];scales[k]=((float)scl.MTime,scl.MValue);}

Comments

  • Platform: Desktop
  • Framework Version: .NET 6.0
  • API: OpenGL 3.3 Core

I'm not sure if this is unique to NodeAnim or if it applies all over the library, so it needs some looking into

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions