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

textures disappear on InstancedRigidBodies when moving or changing pointer #683

Open
s0-david opened this issue Jun 5, 2024 · 4 comments

Comments

@s0-david
Copy link

s0-david commented Jun 5, 2024

when i move around or change the pointer direction, the textures on InstancedRigidBodies vanish. it works fine with instances from drei.

"@react-three/rapier": "^1.3.1",
"three": "^0.165.0",
"next": "14.2.3",

Screenshot 2024-06-06 at 1 25 50 AM
Screen.Recording.2024-06-06.at.1.21.11.AM.mov

any help or suggestions would be appreciated!

@s0-david
Copy link
Author

s0-david commented Jun 6, 2024

useEffect(() => {
    meshRef.current?.computeBoundingBox()
  }, [blocks])

ok so calling the method solved the issue

@s0-david
Copy link
Author

s0-david commented Jun 6, 2024

and computeBoundingSphere too...

@s0-david
Copy link
Author

s0-david commented Jun 6, 2024

on onAfterShadow

@oknesar
Copy link

oknesar commented Oct 7, 2024

It's because of frustumCulled (this is set by default, it checks every frame if the object is in the frustum of the camera before rendering the object. If set to false the object gets rendered every frame even if it is not in the frustum of the camera.)

You either need to set boundingBox\Sphere big enough to cover possible translations of instances or set <instancedMesh frustumCulled={false}

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

2 participants