Hi! I am a noob in three js. How it is possible to obtain data on rotation of a figure?
I tried to find the answer in documentation of three js, here at a forum and in Google, but I didn’t find the answer.
I created plane and rotated it as follows:
let geometry = new THREE.PlaneGeometry (data.width, data.height);
let material = new THREE.MeshBasicMaterial ({color: new THREE.Color (‘#cea6a6’), side: THREE.DoubleSide });
let plane = new THREE.Mesh (geometry, material);
plane.geometry.rotateZ (Math.Pi/4);
Everything works right, but at the same time I can’t get data on rotation in any way.
Rotation and translation of geometry are applied to the geometry right away (so it becomes different), they are not stored separately.
If you want to apply rotations to geometry as a changeable modifier, apply it to the mesh ( or any THREE.Object3D), like so: plane.rotateZ(Math.PI/4);
Then you can check rotation as plane.rotation or plane.quaternion, there are quite a few different methods, related to rotation, that you can use : three.js docs
No, they are not, they will be updated right before the rendering by applying the mesh rotation to vertices (or rather mesh rotation will be supplied to the shader code where the geometry will be modified). This is not a permanent change, it is applied dynamically before every render call (or on every frame if you have animation) to the original geometry that stays the same.
When you render your rotated plane, it should appear rotated though, if it isn’t, provide your code as a link in jsfiddle or codepen, somebody will help you to make it right then.