Hi Hi
Hi Hi

Reputation: 376

Three.js - Get rotated vertices

I am trying to get the new positions of an object's vertices after rotating it using Object.rotation.x. Unfortunately the vertices stay the same and only the rotation matrix is updated. Is there a way to directly get the new points without calculating it all by yourself?

Upvotes: 1

Views: 1626

Answers (1)

Pit
Pit

Reputation: 41

var geom = Object3D.geometry.clone();
geom.applyMatrix(Object3D.matrix);
geom.vertices[n] -  value you need;

or

var vec = Object3D.geometry.vertices[n].clone();
vec.applyMatrix4(Object3D.matrix);

Upvotes: 2

Related Questions