# My Character's Collision to the Trees is not Working :(

**URL:** <https://talk.code3dgames.com/t/my-characters-collision-to-the-trees-is-not-working/306>\
**Category:** Uncategorized\
**Created:** [July 8, 2021, 2:14pm UTC](https://talk.code3dgames.com/t/my-characters-collision-to-the-trees-is-not-working/306 "2021-07-08T14:14:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/martin/32/41_2.png) [@Martin](https://talk.code3dgames.com/u/Martin)\
**Post date:** [July 8, 2021, 2:14pm UTC](https://talk.code3dgames.com/t/my-characters-collision-to-the-trees-is-not-working/306/1 "2021-07-08T14:14:54Z")

</div>

So i am at the Collisions Chapter and my Character can still run into the “notAllowed” Area.So pls Help me bc. my Ground is appearing but my Character can still run to the Trees.  
My Url:  
[https://is.gd/TvuwvZ](https://is.gd/TvuwvZ)

---

<div class="post-metadata">

**Author:** ![chris](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/chris/32/5_2.png) [@chris](https://talk.code3dgames.com/u/chris)\
**Post date:** [July 9, 2021, 3:55am UTC](https://talk.code3dgames.com/t/my-characters-collision-to-the-trees-is-not-working/306/2 "2021-07-09T03:55:36Z")

</div>

You are sooooo close. There are 3 small typos in the code that are causing the problem here. The first you can see in the JavaScript console:

```auto
Uncaught TypeError: THREE.RayCaster is not a constructor
    at isColliding (code.html:59)
    at HTMLDocument.sendKeyDown (code.html:90)

```

If you look at line 59, you’ll find:

```javascript
  var raycaster = new THREE.RayCaster(marker.position, vector);

```

To fix problem #1, you only need to change `RayCaster` to `Raycaster` (lowercase `c`):

```javascript
  var raycaster = new THREE.Raycaster(marker.position, vector);

```

Problems #2 and #3 are both 3 lines down:

```javascript
  if (intersects.lenght < 0) return true;

```

I’m pretty sure you can figure out both problems just by comparing the code to what’s in the book. It wasn’t simple to track these problems down after fixing #1. I eventually just started looking through the code line-by-line, though I started in `isCollision()` since I new that collisions weren’t working. Luckily, it didn’t take _too_ much time since `isCollision()` is kinda small.

Hope that helps. If you run into any more problems, let me know!

-Chris
