Hello!
Based on your transformation exemple (Move), i would like to make a Rotation instead but i don’t know how to set angle in Quaternion format ! Could you help me to format Quaternion in mat4.fromRotationTranslation() section please ?
// Notes on CodeSandBox
// if you don't see a preview when you load this page for the first time, reload the browser tab to the right
import { createViewport, createSession, sceneTree } from "@shapediver/viewer";
import { mat4, vec3 } from "gl-matrix";
(async () => {
// create a viewport
const viewport = await createViewport({
canvas: document.getElementById("canvas") as HTMLCanvasElement,
id: "myViewport"
});
// create a session
const session = await createSession({
ticket:
"319f14f08c1e67a874fd843acecfd321049772deb0cdb5a0dbb39385592a156e83730e45c5e7af5eab52e15b1e36d44a092f71ada1331e1935b0f25d9448af34d0add0bd5abf8984325b97ee9e6106b25216446d15a86bb18b40114df89d2f5909b08e8c8b9eeb-7516be37cb2d968a0b3c545baf3ae51e",
modelViewUrl: "https://sdeuc1.eu-central-1.shapediver.com",
id: "mySession"
});
// clone the node
const clonedNode = session.node.clone();
// add a transformation to it
// clonedNode.transformations.push({
// id: "transformation",
// matrix: mat4.fromTranslation(mat4.create(), vec3.fromValues(0, 25, 0))
// });
clonedNode.transformations.push({
id: "transformation",
matrix: mat4.fromRotationTranslation(mat4.create(), Rotation Quaternion, vec3.fromValues(0, 25, 0))
});
// update the version of the node
clonedNode.updateVersion();
// add the node to the scenetree
sceneTree.root.addChild(clonedNode);
// update everything
viewport.update();
})();