Skip to content

Quat Slerp - No examples? #623

Answered by maluoi
laultman asked this question in Q&A
Apr 25, 2023 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Here's a complete application for context:

using System;
using StereoKit;

SK.Initialize();

Quat   destination = Quat.Identity;
Quat   current     = destination;
Random rand        = new();

SK.Run(() => {
	if (Input.Key(Key.Space).IsJustActive()) {
		destination = Quat.FromAngles(
			rand.NextSingle()*360, 
			rand.NextSingle()*360,
			rand.NextSingle()*360);
	}
	current = Quat.Slerp(current, destination, 16 * Time.Stepf);
	Mesh.Cube.Draw(Material.Default, Matrix.TRS(new Vec3(0, 0, -0.5f), current, 0.1f));
});

And here's what it looks like in action:

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@maluoi
Comment options

Answer selected by maluoi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants