# Use the geometry after having moved an objet

**URL:** <https://discourse.threejs.org/t/use-the-geometry-after-having-moved-an-objet/50496>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [April 17, 2023, 3:45pm UTC](https://discourse.threejs.org/t/use-the-geometry-after-having-moved-an-objet/50496 "2023-04-17T15:45:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![winnip\_fr](https://avatars.discourse-cdn.com/v4/letter/w/c67d28/32.png) [@winnip\_fr](https://discourse.threejs.org/u/winnip_fr)\
**Post date:** [April 17, 2023, 3:45pm UTC](https://discourse.threejs.org/t/use-the-geometry-after-having-moved-an-objet/50496/1 "2023-04-17T15:45:10Z")

</div>

Hello,  
I’d like to move an object in a 3D world then compute the intersection between this object and a plane.  
The issue I’m faced with is that the geometry I get after having moved the object seems to be the geometry before the move.

The main part of my code is as follow:

```javascript
			let currentObject2D = this.scene2D.getObjectByName(nom)
			if (currentObject2D !== undefined) {
				if (currentObject2D.position.y < 30) {
					currentObject2D.position.y += 1
					currentObject2D.updateMatrix()
				}

```

Then:

```javascript
const objetPositionAttribute = currentObject2D.geometry.getAttribute('position')
for (let vertexIndex = 0; vertexIndex < objetPositionAttribute.count; vertexIndex += 3) {
				localVertex.fromBufferAttribute(objetPositionAttribute, vertexIndex)
				objet.localToWorld(a.copy(localVertex))

```

Here the a vector is the position of this array before the translation.

Should I use promises?  
Can you explain what I’m doing wrong please?

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [April 17, 2023, 3:51pm UTC](https://discourse.threejs.org/t/use-the-geometry-after-having-moved-an-objet/50496/2 "2023-04-17T15:51:49Z")

</div>

None of the functions in the snippets are asynchronous - so promises don’t seem necessary.

1. There seems to be quite a few typos.
2. It’s a bit hard to understand what the code does overall - the snippets seem disconnected and have no result 😅 Could you maybe try to replicate the issue [codepen](https://codepen.io/mjurczyk/pen/bGmGaBr), or share a bit more of the related code?

---

<div class="post-metadata">

**Author:** ![winnip\_fr](https://avatars.discourse-cdn.com/v4/letter/w/c67d28/32.png) [@winnip\_fr](https://discourse.threejs.org/u/winnip_fr)\
**Post date:** [April 18, 2023, 2:11pm UTC](https://discourse.threejs.org/t/use-the-geometry-after-having-moved-an-objet/50496/3 "2023-04-18T14:11:04Z")

</div>

Hi, thanks for the reply.  
Sorry to haven’t been clear enough.

The problem was that le matrix used when I use the “localToWorld” matrix that I updated in the first snippet of code.  
I added an this.scene2D.updateMatrixWorld(true) after the updateMatrix() and everything working fine now.

By the way, you have some pretty impressive collection of sample code in your codepen repo.
