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

Suggestion: 'Inverted Collider' Option #444

Open
espressom opened this issue Jan 5, 2024 · 1 comment
Open

Suggestion: 'Inverted Collider' Option #444

espressom opened this issue Jan 5, 2024 · 1 comment

Comments

@espressom
Copy link

espressom commented Jan 5, 2024

I am working on a snow globe project in a React application and would like to propose an 'inverted' option:

image

The rationale behind this suggestion is as follows:

  1. This feature has been actively discussed a few years ago within the Unity community.
  • The Unity engine typically determines the direction of a collider based on normals. Therefore, by flipping the mesh's normals in Blender, it's possible to invert the collider.
  1. Similar requests have recently been posted in the forums of Babylon.js

I would be grateful if you could consider the introduction of an invert collider option to explore more possibilities on the web.

@stockhuman
Copy link
Member

This is one of those features that makes a lot more sense in the real world than it does in a simulation; the way Cannon makes collision logic expedient is by first testing for axis-aligned bounding box intersection - imagine the entire simulation divided into cubes. When the cube approximation of a collider is within the grid space of another collider (a rather simple comparison), more precise math kicks in to actually compute a collision.

Inverting a collider alters the AABB logic: all colliders in your example will always intersect - at least without further resolving - which ends up looking like Trimesh collider logic. Perhaps setting up an approximation of your snow globe with programmatically created planes would suffice?

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