-
Notifications
You must be signed in to change notification settings - Fork 132
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
Align Cannon cylinder orientation with Three's cylinder #13
Comments
Hey @codynova , you may have a look at this issue Cylinder cannon.js vs cylinder three.js #58 #issuecomment-618207128. |
@sunwin123 Thank you for taking a look. For performance reasons, rather than create the shape and then rotate, we should construct the geometry in the correct axes to start with. |
@codynova Agree, if there’s a way to create the geometry with correct rotations, it would be nice. But do they have such APIs ? |
The geometry vertices and faces are mathematically generated here. I haven't looked into it enough yet, but there should be a straightforward way to alter that class to get the desired result during geometry generation. |
I've read the code, it hasn't parameters to alter transformations in geometry creation periods. |
@codynova @sunwin123 Hi guys. I gave this a try... what do you think of the approach in #28 ? Let me know if there is a better way to write the Typescript. |
Hey @ianpurvis, sorry for the delayed response, I've been super busy lately - thanks for taking a look! I agree with Marco that I'd rather this not be configurable, although I can see why you thought that was my goal due to my comment about performance. My concern was generating the geometry in the incorrect axes, then transforming to align with ThreeJS. Instead we want to construct the geometry in the correct axes according to ThreeJS alignment, then allow other transforms at runtime. There is also the option to use ConvexPolyhedron. I'm closing #28 in favor of #30 and have released the updated Cylinder class in |
This issue is readily apparent when using a wireframe debugger for the physics bodies.
We may want to allow specifying the axis orientation in the cylinder constructor - since the most popular way to construct capsule physics bodies is with cylinder+sphere compound bodies, and the most popular capsule geometry primitives are aligned with the Cannon cylinder's current orientation (i.e. not aligned with Three's cylinder)
pmndrs/use-cannon#58
schteppe#58
(cool (or uncool?) coincidence that it's issue 58 in both repos...)
The text was updated successfully, but these errors were encountered: