Object3D center point is not Matching with Mesh center Point which set to center

Hello, Can someone help me with my problem? I have a case where I have an asset and its parent is Object3D when I pick up an object with a raycaster and move it and then pick it again the box helper which added to Object3D is not in his place have any idea why it’s happening like that???
And one more thing after loading the model I correct its pivot like so

function PivotCorection(object) {
  let box3 = new THREE.Box3().setFromObject(object);
  let shift = box3.getCenter();
  // object.position.set(0, 0, 0);
  let pivot = new THREE.Object3D();

  return pivot;

Capture Capture1 Capture2

Where are you creating the BoxHelper? Notice when creating the BoxHelper the target mesh needs to be passed so the BoxHelper can update in the render loop.

var sphere = new THREE.SphereBufferGeometry();
var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
var box = new THREE.BoxHelper( object, 0xffff00 );
scene.add( box );
1 Like