react-globe.gl icon indicating copy to clipboard operation
react-globe.gl copied to clipboard

Raycast exception: Cannot read property 'count' of undefined

Open derwaldgeist opened this issue 4 years ago • 15 comments

I got my globe working now, it's looking amazing.

However, quite often if I hover over it or try to drag it, it throws an exception:

image

After that, the globe won't allow the user to rotate it anymore. It's stuck to its current position and rotation.

What might cause this?

derwaldgeist avatar Jun 17 '21 20:06 derwaldgeist

I can reproduce it pretty reliably if

  • there is a label at lat = 0, lon = 0
  • I hover the mouse over it
  • and then move the mouse within the label's dot
  • but only if I don't rotate the globe before hovering

derwaldgeist avatar Jun 17 '21 20:06 derwaldgeist

@derwaldgeist I've tried your steps but am unable to replicate the issue unfortunately.

Could you make a simple reduced example on https://codesandbox.io/ that reliably replicates the issue so it can be debugged?

vasturiano avatar Jun 17 '21 22:06 vasturiano

I have the same issue in https://github.com/vasturiano/globe.gl/ this version. But I can't reproduce it in a certain way, it's quite random... photo_2021-06-19_23-21-17

moranno avatar Jun 19 '21 15:06 moranno

@maker2002 thanks for contributing. I'm still unable to replicate this issue. Are you able to do an example on https://codesandbox.io that produces this error, even if just occasionally?

vasturiano avatar Jun 19 '21 19:06 vasturiano

Yep, I agree, if seems to happen at random. I just felt it was more reproducible if I hovered above a label created at 0,0. But also here not always.

derwaldgeist avatar Jun 19 '21 19:06 derwaldgeist

I have the same problem and cannot reproduce it reliably, it happens randomly. I am using react-globe.gl with Next.js

err

devtarek avatar Jun 24 '21 13:06 devtarek

While I was tinkering with react-globe.gl (the official example) I also encountered this error three times. It indeed was very random and I also couldn't reproduce it reliably.

zenyr avatar May 11 '22 08:05 zenyr

Can confirm the exact same issue. Seems to happen randomly. Sorry this is not much help in tracking down the root cause.

(edit: here's the code that's throwing the error. maybe that will help)

Screen Shot 2023-02-21 at 11 20 51 am

phocks avatar Feb 21 '23 00:02 phocks

Same here!

DavidDolyak avatar Mar 15 '23 11:03 DavidDolyak

FYI:

I managed to fix this by wrapping this else block of code in an if to check that positionAttribute was set

I did it in my node_modules/three/build/three.module.js which isn't ideal but didn't really know how else to do it.

I just need to remember to do this again if I ever reinstall three via npm or something.

Maybe it needs to be fixed in the three.js repo.

if (positionAttribute) {
  const start = Math.max( 0, drawRange.start );
  const end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );

...
}

phocks avatar Mar 20 '23 04:03 phocks

Hi, I have the same problem, any news about a fix?

marcotw avatar Sep 22 '23 10:09 marcotw

its the draw range......

rwchampin avatar Mar 06 '24 09:03 rwchampin

its because we were calling intersectObject on a mesh like Points.....at least for me and the count was messed up

rwchampin avatar Mar 06 '24 10:03 rwchampin

Maybe this merge request will help?

https://github.com/mrdoob/three.js/pull/28163

dcalano avatar Apr 20 '24 22:04 dcalano