On Click Event I try to manipulate FBX model and trying to fetch position,scale,rotation x,y,z co-ordinates

  1. Just try and see if it works.
  2. Please format your code (there’s a </> button above post editor that lets you pretty-print source code.)
1 Like

yes I tried with above share snip-it it is not working, sure I will use next time </> for code.

Tested it on codepen just to be sure and it does seem to work (you do need some kind of geometry on the root level of the model, otherwise there’s nothing to collide with.)

Or just go the easy way:

loader.load(model => {
  model.traverse(mesh => {
    mesh.userData.root = model;
  });

  scene.add(model);
});

Then just pick the root in raycasting (with recursion enabled to detect submeshes):

const hits = raycaster.intersectObjects(models, true);

if (hits[0]) {
  const model = hits[0].userData.root;

  // Do something with the root model.
}
1 Like

Hello I tried with this but still not working.can you please help me.!

Please provide a live example on either codepen or jsfiddle - I’m not sure what kind of feedback anyone can give you based on a screenshot and “it doesn’t work, help me, thx!” :man_shrugging:

(The code I shown you does work if applied correctly, not copy-pasted.)

1 Like

Yes @mjurczyk, I try to upload my code on codepen but code is not working there. I am attaching zip file of code I hope that will help to understand.I need help when I move obj model I need it’s current position,scale,rotation.PLEASE help me.

step 1. npm install
step 2. npm start
code : demothree/src/components/admin/Admin.js

demothree.zip (4.0 MB)

As earlier - please specify what exactly is not working / what you’re stuck on / what you tried to solve the problem.

Codepen does not necessarily need to contain your entire code - it’s unlikely someone would read and debug it anyway. It should be enough to replicate (or copy) only the part of code that causes a problem - in the process of making it work on codepen you may even accidentally debug the issue on your own. :slight_smile:

(If what you want is for someone to virtually go through your code and debug the entire app for you - this tread probably belongs in #jobs. That’s basically consulting.)

sure Thank you for Suggestion @mjurczyk ,

what I’m stuck on

const intersects = raycaster.intersectObjects(scene.children);
is not detecting obj model interaction,It only taking mesh.