How to Position Object in React-Three-Fiber

I have a cube mesh on a canvas here and I would like to move it to the left (change its X-axis) without changing its point of rotation. I have tried applying the argument position={[1,0,0]} to the mesh component in the box component but it seems that it only shifted the box away from the point of rotation, which is at the center of the canvas. I am planning on creating more 3d boxes similar to the one in the image below in the future, so how would I position them while also keeping each box's point of rotation at the center of the box, separately?

Here is my code:

import React from "react";
import { Canvas } from "@react-three/fiber";
import { OrbitControls } from "@react-three/drei";

function Box() {
  return (
    <mesh>
      <boxBufferGeometry attach="geometry" />
      <meshLambertMaterial attacah="material" color="white" />
    </mesh>
  );
}

const Background= () => {
  return (
    <Canvas>
      <OrbitControls
        enableZoom={false}
        rotateSpeed={2}
        autoRotate={true}
        autoRotateSpeed={5}
      />
      <ambientLight intensity={0.5} />
      <spotLight position={[10, 15, 10]} angle={0.3} />
      <Box />
    </Canvas>
  );
};

export default Background;

I am new to using React Three Fiber so any references/documentation or suggestions would be very helpful. Thanks

1
David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article