# Collision detection with points of a Gltf Model

**URL:** https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837
**Category:** Questions
**Tags:** loaders, geometry
**Created:** [February 23, 2024, 12:44am UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837 "2024-02-23T00:44:10Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![JacksonUptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jacksonuptain/32/37483_2.png) [@JacksonUptain](https://discourse.threejs.org/u/JacksonUptain)
#### Post date: [February 23, 2024, 12:44am UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/1 "2024-02-23T00:44:10Z")

</div>

So I’ve been working on making an amazing collision detection boilerplate code with three js. I noticed that when you traverse a gltf mesh( gltf.scene.traverse((node)) {}  
)  
you actually find that the node has a geometry.box3() element. So I can successfully access that box three and get its parent elements so that I can get its world position, but for some reason I cannot make collision detection with it work. I added a helper, but the scale and the things in the scene just seem wrong to me.

Sorry for the long message. I haven’t made a post in a while. This is the biggest hiccup I’ve had in a while. Thanks!

Appreciate the help very much…feel free to check out my github and my starwars game(in it I made collision detection with raycasters which is kinda terrible)

Thanks again everyone! - Jackson U.

---

<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: [February 23, 2024, 12:56am UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/2 "2024-02-23T00:56:56Z")

</div>

Where’s your github 😃 ?

---

<div class="post-metadata">

### Author: ![JacksonUptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jacksonuptain/32/37483_2.png) [@JacksonUptain](https://discourse.threejs.org/u/JacksonUptain)
#### Post date: [February 23, 2024, 1:06am UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/3 "2024-02-23T01:06:28Z")

</div>

Just look up Jackson uptain

---

<div class="post-metadata">

### Author: ![JacksonUptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jacksonuptain/32/37483_2.png) [@JacksonUptain](https://discourse.threejs.org/u/JacksonUptain)
#### Post date: [February 24, 2024, 1:57pm UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/4 "2024-02-24T13:57:39Z")

</div>

Should I re-ask this question?

---

<div class="post-metadata">

### Author: ![Antonio](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/antonio/32/27527_2.png) [@Antonio](https://discourse.threejs.org/u/Antonio)
#### Post date: [February 25, 2024, 7:52pm UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/5 "2024-02-25T19:52:16Z")

</div>

> [@JacksonUptain](#):
>
> Should I re-ask this question

What you should do is to make the life easier for everyone here and actually share what you have tried and what has been the result.

That said, you will not receive much response by saying “go and search for it on my github”.

 ![Screenshot_20240224_161345_Samsung Internet](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/e/d/ed5c66f26287b56ae831a385bcbcf9db9ce92f18.jpeg)

---

<div class="post-metadata">

### Author: ![JacksonUptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jacksonuptain/32/37483_2.png) [@JacksonUptain](https://discourse.threejs.org/u/JacksonUptain)
#### Post date: [February 25, 2024, 8:05pm UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/6 "2024-02-25T20:05:04Z")

</div>

I did share what I had tried. I traversed the mesh and got the geometry of every child node, but the issue is that it’s not the worlds position; it’s relative to the center of the mesh.

---

<div class="post-metadata">

### Author: ![Fennec](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fennec/32/59265_2.png) [@Fennec](https://discourse.threejs.org/u/Fennec)
#### Post date: [February 26, 2024, 2:47am UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/7 "2024-02-26T02:47:30Z")

</div>

[Object3D.getWorldPosition](https://threejs.org/docs/index.html#api/en/core/Object3D.getWorldPosition)?

---

<div class="post-metadata">

### Author: ![JacksonUptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jacksonuptain/32/37483_2.png) [@JacksonUptain](https://discourse.threejs.org/u/JacksonUptain)
#### Post date: [February 26, 2024, 2:59am UTC](https://discourse.threejs.org/t/collision-detection-with-points-of-a-gltf-model/61837/8 "2024-02-26T02:59:58Z")

</div>

So I thought about that one and it still gave me an outlandish answer when I logged it. I think it’s because it still is giving its parents 3d position and then adding it to that, in which case I get 0.something or 1-3.45something; the scale must be weird or something.
