Quaternions are efficient and robust mathematical objects for
representing rotations! Understanding the details of how a quaternion
works is not generally necessary for using them effectively, so don’t
worry too much if they seem weird to you. They’re weird to me too.
The internal, wrapped System.Numerics type. This can be nice to have around so you can pass its fields as ‘ref’, which you can’t do with properties. You won’t often need this, as implicit conversions to System.Numerics types are also provided.
Creates a rotation that describes looking from a point, to another point! This is a great function for camera style rotation, or other facing behavior when you know where an object is, and where you want it to look at. This rotation works best when applied to objects that face Vec3.Forward in their resting/model space pose.
Creates a rotation that describes looking towards a direction. This is great for quickly describing facing behavior! This rotation works best when applied to objects that face Vec3.Forward in their resting/model space pose.
Allows implicit conversion from System.Numerics.Quaternion to StereoKit.Quat.
Quat.LookAt and LookDir are probably one of the easiest ways to
work with quaternions in StereoKit! They’re handy functions to
have a good understanding of. Here’s an example of how you might
// Draw a box that always rotates to face the userVec3boxPos=newVec3(1,0,1);QuatboxRot=Quat.LookAt(boxPos,Input.Head.position);Mesh.Cube.Draw(Material.Default,Matrix.TR(boxPos,boxRot));// Make a Window that faces a user that enters the app looking// Forward.PosewinPose=newPose(0,0,-0.5f,Quat.LookDir(0,0,1));UI.WindowBegin("Posed Window",refwinPose);UI.WindowEnd();