I am trying to draw box as shown in picture.
but i am not able to draw it as in picture.so anyone can please help me.
You should create your geometry in Blender, export it to glTF and import the asset via GLTFLoader
. This is probably the easiest way, especially for a beginner of three.js
.
You can preview your glTF export with this tool: https://gltf-viewer.donmccurdy.com/
Hi!
I didn’t get, which box you can’t create? The blue one?
yes. I’m not able to draw that blue box.
@pavan Well… You could show us what you’ve tried.
So far I see that that box could be created with THREE.BoxGeometry()
/THREE.BoxBufferGeometry()
.
@Mugen87 Michael, could you give me a hint, why that blue box should be made in Blender? I’m serious, maybe I’m overlooking extraordinary of that box?
I thought the user wants to procedurally create the entire geometry of the screenshot.
@Mugen87
Yeah, I had the same first thought
I am new to Three js but here is fiddle what I have tried.
Your code works correctly.
You just need to add lights and change the material of the box to that affect by light.
https://jsfiddle.net/prisoner849/45few2xe/
Thank you very much.
You’re welcome
In your code i commented orbitControl. but now it’s not working. here is fiddle
Actually, it’s working Your camera doesn’t look at the box.
var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 300);
camera.position.set(2, 3, 4);
camera.lookAt(scene.position); // look at the center of the scene
Ok.
Thank you once again.