In three.js, I want to add a mesh to a position in the scene
I've tried:
// mesh is a THREE.Mesh scene is a THREE.Scene scene.add(mesh) scene.updateMatrixWorld(true) mesh.matrixWorld.setPosition(new THREE.Vector3(100, 100, 100)) scene.updateMatrix()
BUT it didn't affect anything.
What should I do ?
js is a cross-browser JavaScript library and application programming interface (API) used to create and display animated 3D computer graphics in a web browser using WebGL.
Download the three. js library and play around with all the examples included, there's a lot in there. If you want to really throw yourself in at the deep end, start by applying the use of three. js to something you already know how to do, but making it 3D.
i would recommend you to check the documenation over here: http://threejs.org/docs/#Reference/Objects/Mesh As you can see on the top of the docu-page, Mesh inherits from "Object3D". That means that you can use all methods or properties that are provided by Object3D. So click on the "Object3D" link on the docu-page and check the properties list. You will find propertie ".position". Click on ".position" to see what data-type it is. Paha..its Vector3.
So try to do the following:
//scene is a THREE.Scene scene.add(mesh); mesh.position.set(100, 100, 100);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With