[SOLVED!]Collision-detection doesn't work with textures


I updated to r95 and the problem is solved. Looks like r94 has an issue with using material arrays.


I’m completely new to Three.js and right now I am following along with the code from an official example and the problem I have is that I am able to jump onto a box with a one-colour material, but when I add textures to the box then I am not able to jump on it. Here is a pastebin with my code.. I define the material on line 214, and if I use g3colour it works, but as it is right now it doesn’t work. Can you please help me figure this out?

Thank you

I’ve locally tested your code and I can actually jump on the box.


Keep in mind that the code in the example only ensures that the player can stand on top of a box. The player can still walk through objects. So it’s not a full collision detection system^^.

1 Like

That’s really weird…no matter how much I try I can’t jump on it. I guess I’ll try to initiate the full collision detection system and see if that solves the problem. Thanks!

I added a full collision detection system, you can see my code here, but it still doesn’t work with textures. Here is a sample texture you can use if you rename it to ‘texture.jpg’. Again, on line 212 you can switch to g3colour to see the working demo. I have no idea why it doesn’t work with textures. On line 263 when checking intersections I did this: var intersections = raycaster.intersectObjects( objects, true ). According to the docs, this will check for all descendants (idk what that means). Currently, the right-most side is solid, but all other sides are not. Do you know what my problem is?