Sukationg Phuphatana
Sukationg Phuphatana

Reputation: 79

How to rotate model .obj around its center when i use THREE.OBJLoader

I use THREE.OBJLoader for import model obj I use code from https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_obj.html#L75 But I have problem when i need to rotate model that not rotate around itscenter. if i need it rotate around its center. How can I do?

Upvotes: 2

Views: 1370

Answers (1)

WestLangley
WestLangley

Reputation: 104763

You can call

THREE.GeometryUtils.center( geometry );

This will translate the geometry so that it's bounding box is centered at the origin in the object's local coordinate system. Now, when you rotate it, it will rotate around it's "center".

Upvotes: 1

Related Questions