Display model in the center

Ok, I understand. You should have started with this. The important point here is that it’s a user model and you have no insight on how axis are set on the model. Well, in this case, I believe you are left with just two options. Either you reset the axis/matrix on the local object to be on the center of the object or you work it out from the mesh bounderies. I am not a specialist for working from bounderies. I guess I could figure it out but clearly others know much better how to do this.

Can you confirm the above and if my assessment is correct (user meshes with no control on meshes and all new imported meshes need to be targeted at the center point by the arcRotateCamera)? Upon confirmation, I will quickly callin someone who knows best how to do this…

Edit: @PolygonalSun would you be able to kindly tell @Ashish_Abhiwan how to master camera targeting for user meshes (as per the above - either by resetting the local axis on the mesh or from bounderies or any other technique you are aware of…I know you’re kind of the specialist for this kind of things) while I’m still learning :wink: Thanks a lot,

yeah that what is happening and i want that the model should be in the center

@mawa hii, is there any solution of this i tried somethings but was unable to anything on this.

Indeed. There is a solution. It’s holidays period. :parasol_on_ground: You might need to have some more patience :hourglass_flowing_sand: but I am sure we’ll shortly figure this out.
May be meanwhile you can work out some other parts of your project…

Hi. Maybe you could try this approach I previously explained in one of the threads. You can find the playground example bellow the huge comment I made where I explain the process.

1 Like

no it did not worked for me, is there any other process so that we can do this.

Do you have a new PG with your attempt. When you say ‘it did not work’, it could be just because of an error in your code (no offense here, not as if this thing was ez). Could you share your non-working attempt with us? Thanks,

yeah sure, https://playground.babylonjs.com/#3I55DK#541 is the play gound

Hmm. @Ashish_Abhiwan This PG doesn’t seem to have any part of the code shared by @nogalo.
May be the wrong link?
@nogalo Sry to bother you but you wouldn’t happen by any chance to have some time to quickly implement your code in this PG? I’m sorry, I’m a bit in the middle of a ton of other things and I’m also clearly not an expert on this. Thanks,

yeah by mistake i gave the wrong link this is the propper link of that implmentation

1 Like

@mawa were you able to rectify the error that i make in the pg

No. I was just waiting on @nogalo. It’s his solution and, as I said, not really my cup of tea, sorry.
If you have no answer or solution by tomorrow, I can try take some time to have a closer look at it but right now I can’t (it’s already nearly time for me to cook dinner and I have just too many other things to attend to). Sorry. Hope it won’t be too long before you get your solution.

Why not using this ? Camera Behaviors | Babylon.js Documentation

1 Like

Oh yes, why not? Completely forgot about this.
By any chance, You wouldn’t be able to quickly attempt implementing this in the PG above for a trial? @Ashish_Abhiwan is a dedicated user but not the best at digging into code and doc (hope I’m not offending you when saying this, and then actually, I’m also a designer and mostly like things straight forward and ez :grinning:

well i am not offended, i will try to implement it

@sebavan @mawa i implemented it but recived error how can i do that on impoted model

Thanks well i did it i made some error i fixed that


The error comes from that you are targeting ‘newMeshes’ but the camera can only target a single mesh.
Here (below PG) I’m targeting mesh[0] (the first mesh in the hierarchy). However, I’m afraid that this will just not entirely solve your issue. It’s still a good start I suppose…

Yes. As I said, a good start. It will however not change the fact that if you want to center and focus on different parts of the model, you will still need to implement this part. Hope you’ll figure it out from the above. Else, let us know and meanwhile, have a great day :sunglasses: