Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raycast exception: Cannot read property 'count' of undefined #59

Open
derwaldgeist opened this issue Jun 17, 2021 · 15 comments
Open

Raycast exception: Cannot read property 'count' of undefined #59

derwaldgeist opened this issue Jun 17, 2021 · 15 comments

Comments

@derwaldgeist
Copy link

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 derwaldgeist changed the title Raycast exception Raycast exception: Cannot read property 'count' of undefined Jun 17, 2021
@derwaldgeist
Copy link
Author

derwaldgeist commented Jun 17, 2021

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

@vasturiano
Copy link
Owner

@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?

@moranno
Copy link

moranno commented Jun 19, 2021

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

@vasturiano
Copy link
Owner

vasturiano commented Jun 19, 2021

@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?

@derwaldgeist
Copy link
Author

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.

@devtarek
Copy link

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

err

@zenyr
Copy link

zenyr commented May 11, 2022

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.

@phocks
Copy link

phocks commented Feb 21, 2023

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

@DavidDolyak
Copy link

Same here!

@phocks
Copy link

phocks commented Mar 20, 2023

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 ) );

...
}

@marcotw
Copy link

marcotw commented Sep 22, 2023

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

@rwchampin
Copy link

its the draw range......

@rwchampin
Copy link

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

@dcalano
Copy link

dcalano commented Apr 20, 2024

Maybe this merge request will help?

mrdoob/three.js#28163

@z1ndabad
Copy link

z1ndabad commented Sep 4, 2024

This is a cursory observation from someone new to both Three and this library, so YMMV. But I've found that I only hit this issue when passing bad data to the globe--i.e., making sure all keys used by accessors were defined before passing data to the globe fixed this error for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests