Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to rotate a sprite object in three.js?

I need to rotate a sprite object but it seems this is not feasible, if not, is there a way to achieve the rotation effect, maybe through the UV coordinates of the spriteMaterial, or a custom shader? what would be the best way to go?

like image 336
Memo Lestas Avatar asked Nov 28 '22 13:11

Memo Lestas


1 Answers

The rotation of a Sprite is set by its material's rotation parameter. For example, like so:

var material = new THREE.SpriteMaterial( {
    color: 0xffffff, 
    map: texture,
    rotation: Math.PI / 4
} );

var sprite = new THREE.Sprite( material );

three.js r.67

like image 166
WestLangley Avatar answered Dec 10 '22 14:12

WestLangley