Willis
Willis

Reputation: 777

How can I move the object down with three.js?

Recently I've seen a example of three.js: https://threejs.org/examples/#webgl_decals I've changed the obj myself, but I'm not familiar with webGL or three.js, I don't know how I can move the object a little down(see the image). I've read the documentation of three.js and tried to change some arguments which I suppose it can move the object down, I'm a new guy in three.js and WebGL.

how can I move the figure down

Upvotes: 1

Views: 2250

Answers (1)

Craig.Li
Craig.Li

Reputation: 1366

Your object has an attribute named 'position', it shows how to place your object in the space, the type of 'position' is THREE.Vector3 which has 3 dimensions x, y and z. so you can use these simple code to move your object:

yourobjcet.position.x+=somevaluex;
yourobjcet.position.y+=somevaluey;
yourobjcet.position.z+=somevaluez;

//or, use built-in function 
yourobject.translateY(somevalue);

You just need to make your object's position y down.

Or, if you just want to center your object, you could use yourobject.geometry.center().

Upvotes: 0

Related Questions