Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Three.js Rotate Texture

Tags:

three.js

I have a texture applied to a mesh I can change the offset with

mesh.material.map.offset.set

I can change the scaling with

mesh.material.repeat.set

so my question is, how can I rotate texture inside a plane?

Example:

From This:

enter image description here

To this

enter image description here

Thanks.

like image 812
JayMoretti Avatar asked May 24 '13 04:05

JayMoretti


1 Answers

three.js r121

In the newer version of the three.js, you can directly set rotation and rotation center of texture.

var texture = new THREE.Texture( ... );
texture.rotation = Math.PI/4;
texture.center = new Vector2d(0.5, 0.5); // center of texture.
like image 77
Okan Pınar Avatar answered Oct 20 '22 14:10

Okan Pınar