# Translation Issue? 4x4 Transformation Matrix "flattening" 3d model

**URL:** <https://discourse.threejs.org/t/translation-issue-4x4-transformation-matrix-flattening-3d-model/44007>\
**Category:** Questions\
**Tags:** transform-matrix, matrix4, bufferattributes\
**Created:** [October 25, 2022, 8:46pm UTC](https://discourse.threejs.org/t/translation-issue-4x4-transformation-matrix-flattening-3d-model/44007 "2022-10-25T20:46:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chron1cle](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@chron1cle](https://discourse.threejs.org/u/chron1cle)\
**Post date:** [October 25, 2022, 8:46pm UTC](https://discourse.threejs.org/t/translation-issue-4x4-transformation-matrix-flattening-3d-model/44007/1 "2022-10-25T20:46:43Z")

</div>

Hi all, so I have a series of vertices stored in a BufferAttribute in which I need to translate 100 units on the z axis. I see that there’s an applyMatrix4 method in which I can apply a 4x4 transformation matrix to accomplish exactly this. I apply the matrix, which seems to correctly shift my 3d Model, but then flattens it.

**Before**

 ![swag2](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/5/f/5f85ea091d5b19686a7ea406964e45b4e8af3509.png)

**After [Shifted correctly, but flattened]**

 ![swag1](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/d/3/d30c0a6194d13daadc6ba7d34f88e4f258af284f.png)

Here’s my code, if that helps. Thanks.

```javascript
let origins = loadedGeometry.attributes.position.clone();
const m = new THREE.Matrix4();
m.set(1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 100, 0, 0, 0, 1);
origins.applyMatrix4(m);

```

[SOLVED]  
Ah, my transformation matrix had the 0’s and 1’s in the wrong places. Haha thanks all!

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [October 25, 2022, 8:58pm UTC](https://discourse.threejs.org/t/translation-issue-4x4-transformation-matrix-flattening-3d-model/44007/2 "2022-10-25T20:58:50Z")

</div>

BufferAttribute has `.applyMatrix4()` method, that calls `vector.applyMatrix4()` internally.  
And for `Vector3`, `.applyMatrix4()` docs say:  
_Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective._  
So, there shouldn’t be a problem with applying Matrix4 on a buffer attribute with 3 components per item. 🤔

---

<div class="post-metadata">

**Author:** ![chron1cle](https://avatars.discourse-cdn.com/v4/letter/c/5fc32e/32.png) [@chron1cle](https://discourse.threejs.org/u/chron1cle)\
**Post date:** [October 25, 2022, 9:25pm UTC](https://discourse.threejs.org/t/translation-issue-4x4-transformation-matrix-flattening-3d-model/44007/3 "2022-10-25T21:25:23Z")

</div>

Oh I think you’re right. It is translating correctly, so it must be something else causing the strange behavior. I’ve updated the post, thanks.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [October 25, 2022, 9:30pm UTC](https://discourse.threejs.org/t/translation-issue-4x4-transformation-matrix-flattening-3d-model/44007/4 "2022-10-25T21:30:34Z")

</div>

Why not try:

```nohighlight
const m = new THREE.Matrix4().setPosition(0, 0, 100);
origins.applyMatrix4(m);

```
