# Cant get vertices in three js anymore

**URL:** https://discourse.threejs.org/t/cant-get-vertices-in-three-js-anymore/57520
**Category:** Questions
**Tags:** geometry, mesh, collision-detection, vertices, collisions, obj
**Created:** [October 28, 2023, 9:39pm UTC](https://discourse.threejs.org/t/cant-get-vertices-in-three-js-anymore/57520 "2023-10-28T21:39:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![victor\_Avelar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/victor_avelar/32/26693_2.png) [@victor\_Avelar](https://discourse.threejs.org/u/victor_Avelar)
#### Post date: [October 28, 2023, 9:39pm UTC](https://discourse.threejs.org/t/cant-get-vertices-in-three-js-anymore/57520/1 "2023-10-28T21:39:39Z")

</div>

I have been trying to make a physics engine for long enough and still haven’t found a way to get the vertices to detect collisions because I need obj meshes to have their own collisions but I only found ways for cubes and spheres but not obj meshes. I’ve tried to use geometry.vertices but it just says its undefined I think it has been deprecated is what I think. Here is an example of what I really wanted to use but its probably been deprecated because I console.logged object.geometry and I am pretty sure its just deprecated.

```javascript
for (var vertexIndex = 0; vertexIndex < Player.geometry.vertices.length; vertexIndex++)
{       
    var localVertex = Player.geometry.vertices[vertexIndex].clone();
    var globalVertex = Player.matrix.multiplyVector3(localVertex);
    var directionVector = globalVertex.subSelf( Player.position );

    var ray = new THREE.Ray( Player.position, directionVector.clone().normalize() );
    var collisionResults = ray.intersectObjects( collidableMeshList );
    if ( collisionResults.length > 0 && collisionResults[0].distance < directionVector.length() ) 
    {
        // a collision occurred... do something...
    }
}

```

---

<div class="post-metadata">

### Author: ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)
#### Post date: [October 28, 2023, 10:32pm UTC](https://discourse.threejs.org/t/cant-get-vertices-in-three-js-anymore/57520/2 "2023-10-28T22:32:31Z")

</div>

Yup. It’s geometry.vertices has been deprecated. Now vertices are stored in geometry.attributes.position.array.  
Look at the docs for BufferGeometry to see accessing methods… or just grab them out of the array… it’s a flat array of xyzxyzxyzxyz

---

<div class="post-metadata">

### Author: ![victor\_Avelar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/victor_avelar/32/26693_2.png) [@victor\_Avelar](https://discourse.threejs.org/u/victor_Avelar)
#### Post date: [October 29, 2023, 3:14am UTC](https://discourse.threejs.org/t/cant-get-vertices-in-three-js-anymore/57520/3 "2023-10-29T03:14:13Z")

</div>

yeah I used that one and it worked thanks!
