# Make camera fix and 3d turn around himself

**URL:** <https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574>\
**Category:** Questions\
**Created:** [March 29, 2020, 6:45pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574 "2020-03-29T18:45:42Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 29, 2020, 6:45pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/1 "2020-03-29T18:45:42Z")

</div>

good evening everyone, I have a little problem with the poisitioning of the camera and the loaded scene, I would like to know how to fix the camera and rotate the object on itself here is the code that I use thank you.

 ![Capture d’écran de 2020-03-29 19-44-31](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/d/d489a0719bc76c47a3318fc46911629a7ec5543d.png)  
ps: im building a configurator with babylonjs and angular

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 29, 2020, 7:01pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/2 "2020-03-29T19:01:30Z")

</div>

to be more precise I want to click or drag with the mouse and turn the shirt to one side or the other  
neither up nor down and the camera doesn’t move.  
knowing that I’m loading a scene that contains abstractmesch and not mesch.

 ![Capture d’écran de 2020-03-29 20-00-11](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/6/6617041cb46ff23272817efc06bfdf9bb8968517.jpeg)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 29, 2020, 7:31pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/3 "2020-03-29T19:31:49Z")

</div>

You can add this code to only be able to rotate around the object:

```javascript
    camera.lowerBetaLimit = camera.beta;
    camera.upperBetaLimit = camera.beta;
    camera.lowerRadiusLimit = camera.radius;
    camera.upperRadiusLimit = camera.radius;

```

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 29, 2020, 8:36pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/4 "2020-03-29T20:36:08Z")

</div>

it didn’t work [Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)

 ![Capture d’écran de 2020-03-29 21-34-28](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/9/90d7621acfc2bbd3d03cae1808383156521c6812.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 29, 2020, 8:59pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/5 "2020-03-29T20:59:38Z")

</div>

It works for me here:

[https://playground.babylonjs.com/#J67M1I](https://playground.babylonjs.com/#J67M1I)

I can only rotate around the scene.

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 30, 2020, 2:10am UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/6 "2020-03-30T02:10:13Z")

</div>

I saw that it worked for you and I thank you for your answer, but in my case it doesn’t work , maybe because of the babylon that I’m loading, I don’t know

 ![Capture d’écran de 2020-03-30 03-04-30](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/b/bd67107567ef4cb015218ca6dc6786043e7336e7.png)  
when i use  
this.scene.createDefaultCamera(true,true,true)  
the camera moves, and the scene rotates but not on itself .

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [March 30, 2020, 3:24am UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/7 "2020-03-30T03:24:25Z")

</div>

He wants to spin the mesh not the camera I think.

If that is the case, you need to not attach camera controls, and interpolate the mouse input into inertia values on the mesh through a system of your own device.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 30, 2020, 8:42am UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/8 "2020-03-30T08:42:05Z")

</div>

> [@Ilyes\_ELAYEB](#):
>
> when i use  
> this.scene.createDefaultCamera(true,true,true)

This will remove the upper and lower limits you set previously, so I wouldn’t do that.

Can you try reproducing that on the playground? copy your code and make it work (or not work 🙂 ) the same as in your code, so we can understand what’s the problem. I have a feeling we are not seeing the entire code that can affect the scene’s camera

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 31, 2020, 2:21am UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/9 "2020-03-31T02:21:26Z")

</div>

sorry I don’t know how to append my .babylon scene to the playground but this is my code,  
when I append the scene  
the object appears upside down,

 ![Capture d’écran de 2020-03-31 03-16-04](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/a/a857df26ef01f72a9e04499f0e730ee828aa9b52.png)  
but it rotate on itself (and the camera is not fixed).  
when I did  
this.scene.meshes.forEach(element =\> {  
element.rotation.y = Math.PI  
element.position.x = -180.0;  
element.position.z = -70;  
element.material = textures  
});  
} catch (err) {  
console.log(‘error!’, err)  
}  
to put it back in place the object does not turn on itself anymore  
this is why im trying to fix the camera and turn the meshs on them self

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 31, 2020, 11:08am UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/10 "2020-03-31T11:08:27Z")

</div>

How to use external assets in the PG: [Using External Assets - Babylon.js Documentation](https://doc.babylonjs.com/resources/external_pg_assets)

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 31, 2020, 12:27pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/11 "2020-03-31T12:27:10Z")

</div>

[https://www.babylonjs-playground.com/#IX12S2#13](https://www.babylonjs-playground.com/#IX12S2#13)  
this is my pg , i use the rotation and translate to turn the object in the invers postion because it load upside down , thnx

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 31, 2020, 12:52pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/12 "2020-03-31T12:52:37Z")

</div>

Here it is:

[https://www.babylonjs-playground.com/#IX12S2#14](https://www.babylonjs-playground.com/#IX12S2#14)

You should rotate the shirt around an axis that passes through it, as it is not modeled so that the (0,0,0) coordinate of its local space is at the center of the shirt (it would be easier if it is).

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 31, 2020, 1:26pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/13 "2020-03-31T13:26:09Z")

</div>

Thank you, it works, but I had to comment.  
scene.activecamera = camera  
because it gave me this error  
Type ‘Camera’ is missing the following properties from type ‘ArcRotateCamera’: alpha, beta, radius, \_target, and 111 more.ts(2740)

 ![Capture d’écran de 2020-03-31 14-20-02](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/2/20a95a329dfb437e12f2bcb5ff9556603b6bb13f.png)

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 31, 2020, 1:49pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/14 "2020-03-31T13:49:19Z")

</div>

i would like to know how to zoom also on the object without lossing the rotation around the axe beside the error of  
scene.activecamera = camera  
Type ‘Camera’ is missing the following properties from type ‘ArcRotateCamera’: alpha, beta, radius, \_target, and 111 more.ts(2740)  
thank you ,and I’m sorry for the inconvenience.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 31, 2020, 1:57pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/15 "2020-03-31T13:57:37Z")

</div>

You are in typescript, you should do:

`this.camera1 = this.scene.activeCamera as BABYLON.ArcRotateCamera;`

To be able to zoom, just comment out:

```javascript
      //camera.lowerRadiusLimit = camera.radius;
      //camera.upperRadiusLimit = camera.radius;

```

---

<div class="post-metadata">

**Author:** ![Ilyes\_ELAYEB](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ilyes_elayeb/32/7662_2.png) [@Ilyes\_ELAYEB](https://forum.babylonjs.com/u/Ilyes_ELAYEB)\
**Post date:** [March 31, 2020, 2:23pm UTC](https://forum.babylonjs.com/t/make-camera-fix-and-3d-turn-around-himself/9574/16 "2020-03-31T14:23:36Z")

</div>

Thank you all so much for helping me and especially you. [Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov) 😃
