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

Invert Colliders #521

Open
CosyStudios opened this issue Jun 18, 2024 · 4 comments
Open

Invert Colliders #521

CosyStudios opened this issue Jun 18, 2024 · 4 comments

Comments

@CosyStudios
Copy link

Is your feature request related to a problem? Please describe.

I'm trying to use the colliders array in a particular scenario where the camera is inside a collider.
(Specifically a generative planet model that has its height map displaced inward) & I'm trying to avoid the camera going a)outside of the containing sphere as well as avoid the "mountains" etc that extrude inward.

For simplicity, I created a collider mesh with radius equal to the planet radius minus the tallest peak of the displacement with the view this would stop the camera going any closer to the interior surface than the heighest displaced point.

Evidently the colliders function with the camera assumed to be outside of the collider.. When the camera is moved outside / between the collider and the real mesh, I cant re-enter the collider so its obviously doing its job, but the wrong way round to what i desire.

Describe the solution you'd like

Is there any way the collider detection can be inverted so that it stays inside the collider mesh rather than avoids the outside?

Describe alternatives you've considered

No response

Additional context

No response

@yomotsu
Copy link
Owner

yomotsu commented Jun 18, 2024

So, I think you can simply reverse the sphere face direction.

@CosyStudios
Copy link
Author

Appreciate the speedy reply Yomotsu
as in set side: BackSide on the material?

doesn't seem to affect the outcome...

@CosyStudios
Copy link
Author

unless you mean id have to construct my own custom sphere buffergeometry and somehow do it in the constuction of that?

@yomotsu
Copy link
Owner

yomotsu commented Jun 19, 2024

What about this?
https://discourse.threejs.org/t/how-to-flip-normal-in-buffergeometry/35206

Also, to better understand your case, would you mind providing a simplified example in JSFiddle, CodeSandbox, or any other similar platform? This would greatly assist 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

2 participants