Open ameent opened 10 years ago
To see the issue I'm running into, change the demos/plie.html and instead of a Sphere in the loop, add a Cylinder as such:
var sphereShape = new CANNON.Cylinder(size/2, size/2, size/10, 8);
Hello Ameen,
I think making the Cylinder
into an own type is a very good idea. The convex class is indeed a bit too generic for this case. I'd design the Cylinder
like the Box
shape is right now: it adds special case code and falls back on the ConvexPolyhedron
.
These optimizations could be done, as I see it.
planeCylinder
method for the ContactGenerator
is a good and simple start.Furthermore,
Can't think of any direct setting in Cannon, except that .useBoundingBox, that would speed up this.
I agree that the field names (.ni, .ri, .rj) are a not very decriptive. If you can come up with better names, I'd be greatful. Check the source for docs. By the way, .ni, .ri, .rj should be the only fields that you have to worry about.
Please keep using dev
branch for development and pull requests.
Thanks for the feedback, and any other future contributions!
Stefan
Hello there,
I started playing with your library yesterday so my understanding is very limited of it. I'm creating a lot of cylinders (which at the end are just convex polyhedrons). The nearphase algorithm becomes extremely slow and chokes up bringing the fps down to about 10 when I add upwards of 15 cylinders in my scene. When I changed the shapes to spheres, the same amount of shapes cruise along at 60 fps.
I looked into the ContactGenerator class and see that for cylinders the convexConvex function is used which is fairly generic.
I'm thinking that introduction of cylinder as a basic shape may be helpful here. I'll have some time in about 2 weeks and would be more than happy to contribute, however, before I dig my way in a tunnel, I'd like to know a couple of things:
I'm running the dev branch code.
Thanks! -Ameen