Relative Content

Tag Archive for three.js

Why is fitToBox sometimes zooming on origin instead of mesh

if ((boxSize.x > 1 || boxSize.y > 1) && this.mesh) { const cameraAspect = this.camera.aspect; const horizontalPadding = (boxSize.x – boxSize.y * cameraAspect) / 2; const verticalPadding = (boxSize.y – boxSize.x / cameraAspect) / 2; this.controls.fitToBox(this.mesh, true, { paddingTop: verticalPadding, paddingBottom: verticalPadding, paddingLeft: horizontalPadding, paddingRight: horizontalPadding, }); } Occasionally the camera will zoom to the […]

Can’t see material on BufferGeometry

so i’m new to threejs and i was trying to render a basic rectangle using BufferGeometry but i can’t see the material that was applied to the geometry.

Three JS Mesh Edges During Morph

I have a mesh which has line segments added to it which help define its shape when rendered. i use the following code to add the lines:

DragControls but only along the local Z axis

How can I move an object by dragging by **mouse **(for example using DragControls) but only along the **local ** Z axis of the object (round trip) , not in world coordinates.
I can only limit it in world coordinates, but it is necessary for the object to move along its local Z coordinate.