# Pivot and local positionning

**URL:** <https://forum.babylonjs.com/t/pivot-and-local-positionning/22630>\
**Category:** Questions\
**Created:** [July 27, 2021, 11:52am UTC](https://forum.babylonjs.com/t/pivot-and-local-positionning/22630 "2021-07-27T11:52:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvaisman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bvaisman/32/20835_2.png) [@bvaisman](https://forum.babylonjs.com/u/bvaisman)\
**Post date:** [July 27, 2021, 11:52am UTC](https://forum.babylonjs.com/t/pivot-and-local-positionning/22630/1 "2021-07-27T11:52:33Z")

</div>

Hi everybody,

I have a problem when i wan’t to change the local axes of a mesh.

Here’s the playground : [https://playground.babylonjs.com/#BRY0P8](https://playground.babylonjs.com/#BRY0P8)

it seem to work because the position of box seems to be calculated from the left corner of the box but when i wan’t to show the local axes, they still are in the middle of the cube.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/a/3afe5ea59ea318b45ef7650bb38a64ef3fe3724e.png)

I don’t understand why

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 27, 2021, 1:02pm UTC](https://forum.babylonjs.com/t/pivot-and-local-positionning/22630/2 "2021-07-27T13:02:39Z")

</div>

This is by design in how the Gizmo are working, @Cedric might have a trick ?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 27, 2021, 1:19pm UTC](https://forum.babylonjs.com/t/pivot-and-local-positionning/22630/3 "2021-07-27T13:19:04Z")

</div>

hi @bvaisman

Gizmo is positioned on (0,0,0) local position. Which is the center of the cube. The gizmo position is not the pivot position.  
Use intermediate transform between object and the gizmo isf you want to place the gizmo somewhere else.

---

<div class="post-metadata">

**Author:** ![bvaisman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bvaisman/32/20835_2.png) [@bvaisman](https://forum.babylonjs.com/u/bvaisman)\
**Post date:** [July 27, 2021, 1:27pm UTC](https://forum.babylonjs.com/t/pivot-and-local-positionning/22630/4 "2021-07-27T13:27:05Z")

</div>

Hi @Cedric

I agree but I think i’ve changed the local position of the cube with the setPivotMatrix function.

If I display the position of the cube, it’s [0,0,0] which is exactly the position of the sphere.

I don’t understand why the gizmo still remains in the centre of the cube.

I’m sure i don’t work correctly but i don’t know where is my mistake.

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [July 27, 2021, 1:40pm UTC](https://forum.babylonjs.com/t/pivot-and-local-positionning/22630/5 "2021-07-27T13:40:25Z")

</div>

Please note that

```javascript
box.setPivotPoint(vect);
box.setPivotMatrix(BABYLON.Matrix.Translation(1,1,1), false);

```

Are alternative methods of applying a pivot that behave differently. The first does not change the mesh position. Alternating between lines 25 and 26 in the following playground will show you the difference.

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

More information in the docs

> **[Pivots | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/mesh/transforms/parent_pivot/pivots)**
>
> Learn about pivots in Babylon.js.

The

```javascript
box.setPivotMatrix(BABYLON.Matrix.Translation(1,1,1), false);

```

method makes the pivot behave as in these very old docs prior to the changes.

[http://babylonjsguide.github.io/advanced/Pivots](http://babylonjsguide.github.io/advanced/Pivots)

You could attach the gizmo to the sphere [https://playground.babylonjs.com/#BRY0P8#2](https://playground.babylonjs.com/#BRY0P8#2)

or a TransformNode [https://playground.babylonjs.com/#BRY0P8#3](https://playground.babylonjs.com/#BRY0P8#3)

in which case you may as well use the TransformNode as a parent and as the center of rotation [https://playground.babylonjs.com/#BRY0P8#4](https://playground.babylonjs.com/#BRY0P8#4)

Plenty of choices for you to decide which is best for you.
