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
Simple collision example #20836
Simple collision example #20836
Conversation
Notice that there is already a k-d tree implementation in In general I'm not feeling so well with adding space-partitioning structures at all to this repo. I've planned to suggest to remove The |
Here's the live example link: http://raw.githack.com/supereggbert/three.js/octree-collision/examples/misc_octree_collisions.html Really nice demo! |
@Mugen87 Apologies, maybe my naming the class “octree” is inappropriate. It's intended to be a collider for generic triangle meshes. So perhaps, a rename to TrimeshCollider may be better? It's primary purpose isn’t to be a spacial index, it simply makes use of one. It adds the ability to do collision tests against a trimesh that aren't just ray queries, i.e. sphere intersections and capsule intersections, something not currently supported directly in three.js. If the use of a spatial index is an issue, I can remove it and both the class and example should still work fine. However, it would limit its use to trimeshes consisting of 1000s of triangles; it currently scales to 100,000s with the inclusion of a little extra code to build an index. |
The final decision is up to @mrdoob but I have in general problems to expand the repository with logic that normally belongs to a game engine. Besides, the problem is that all code in the repository needs to be maintained. And I have the feeling we are already spending too much of our limited time in maintaining and support code in Sorry, I know this issue should be discussed separately but this PR was some sort of opportunity for me to write it down. Your code is definitely great but I think it belongs to an own repository. |
@Mugen87 I totally understand, and I'm 100% happy either way. Maybe, hosting externally and instead adding to the "Useful links" in the docs is more appropriate? |
Yeah this sounds good to me. Besides, I recommend to make a post in the forum's Resources category about the code. This would also allow you to explain the code, the motivation behind it and receive feedback of curious community members. |
This is fantastic @supereggbert! |
Lately I've been thinking of doing basic game examples that people can use as a base. Mainly because it's pretty hard to put all the available web apis together and make something work on desktop and mobile. I think this is perfect for
Yes, I completely understand. I think in 2021 we could focus on dong some clean up and merge and/or remove examples. |
Thanks! |
Sounds good! 👍 |
@supereggbert Do you mind having a look at this question about the new code in the forum? https://discourse.threejs.org/t/large-model-collision-follow-games-fps-example/22424 |
@Mugen87 Apologies for the delay, I've only just seen. I'll take a look now. |
Related issue: --
Description
This is a simple example of doing some collisions within three.js, using its maths functions, without having to resort to the bloat and overhead of a full physics engine.
There are basic octree and capsule implementations, that are by no means complete. I've tried to keep things simple so It will hopefully serve as a good starting point for three.js projects.