Help setting up matrix as member data in struct


very new to nalgebra. for the life of me, i cannot find or figure out how to make my struct happy. I need this 3x3 matrix (and also quaternion) to be member data inside of this struct,

struct RigidBody
    mInertia: Matrix3 <f32>,
    mInertiaInverse: Matrix3 <f32>,
    Quat: UnitQuaternion<f32> 

but i get the following error:

I am not finding any helpful documentation and examples of nalgebra of how to simply set this up to give the proper parameters. i just need to feed the 3x3 matrix f32 types, and same for the quaternion. i tried giving it other parameters but it just says unexpected type argument. i appreciate any help. thanks


This error means that Matrix3<f32> does not implement the Default trait. You probably have this error because you put a #[derive(Default)] on your struct containing mInertia.

Are you using the latest version of nalgebra? Because implementation of Default for matrices has been added/published recently.

Thanks so much for the response.

Yes, removing the default trait worked! Im dumb for not trying that lol sheesh.
I was using version .18, so i changed it to .20. ill try it again with default and see what happens.
Thanks again for the quick reply dude, saved me some frustration :smiley: