You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently don't plan to add those shapes in a near future. It is currently possible to approximate those shapes with a tessellated mesh and using a ConvexMeshShape in ReactPhysics3D.
However, if many people are interested in this feature. I can reconsider this of course.
Yeah, I am also looking forward to a cylinder shape since I am working on a dice simulation software. Maybe currently I have to resort to a tessellated mesh even though it looks a bit odd.
Yeah, I am also looking forward to a cylinder shape since I am working on a dice simulation software. Maybe currently I have to resort to a tessellated mesh even though it looks a bit odd.
@patrikpatrik Hi, it is quite a long time since I wrote this code. At that time, it was version 0.8.0. I am not sure whether this method is broken for 0.9.0.
Have you tried this simple code where there is also a floor to collide with. Some settings for the floor:
// Create a rigid body in the world
Vector3 position(0, 20, 0);
Vector3 floorPosition(0, -100, 0);
Quaternion orientation = Quaternion::identity();
Transform transform(position, orientation);
Transform floorTransform(floorPosition, orientation);
RigidBody* floor = world->createRigidBody(floorTransform);
floor->setType(BodyType::STATIC);
// Half extents of the box in the x, y and z directionsconst Vector3 floorSize (100000, 100, 100000);
/* other code */
BoxShape* floorShape = physicsCommon.createBoxShape(floorSize);
Transform transform0 = Transform::identity();
floor->addCollider(floorShape, transform0);
Yeah I've tried creating a ground. I got it to work on the default convex cube method on the user manual page and a 3 sided equilateral triangle. Here is a snapshot of the cylinder in action. I turned down the cylinderSides count to 100 for testing, the camera is looking slightly down as the cylinder just passed through the floor. I had the debug lines enabled to see it. I also noticed there seems to be no mesh on the top and bottom ? Or maybe its just one big piece.
I am not quite sure where the problem lies since in my code snippet vertices of each face are defined clockwise so as to satisfy the requirement.
About the mesh line on the top and bottom, I am not quite sure why. But according to the code itself, there are $N+2$ faces added to the cylinder, where $N$ is the number of cylinderSides.
Sorry I am not familiar with the graphic interface provided by the library (including how debug lines work). Probably the logic there is a bit different from doing the simulation from the terminal.
P.S. I am just about to sleep, so there can be delay of response.:-)
Clockwise? But in the user manual @ 11.1.4 Convex Mesh Shape it states: When you specify the vertices for each face of your convex mesh, be careful with their order. The vertices of a face must be specified in counter clockwise order as seen from the outside of your convex mesh.
I reckon the idea behind the code snippet is relatively clear. Each face is built first, and then faces are added to the mesh according to the sequence of $N$ sides, top side and bottom side.
Activity
DanielChappuis commentedon May 21, 2021
Hello. Thanks for your feedback.
I currently don't plan to add those shapes in a near future. It is currently possible to approximate those shapes with a tessellated mesh and using a ConvexMeshShape in ReactPhysics3D.
However, if many people are interested in this feature. I can reconsider this of course.
Teddy-van-Jerry commentedon Oct 3, 2021
Yeah, I am also looking forward to a cylinder shape since I am working on a dice simulation software. Maybe currently I have to resort to a tessellated mesh even though it looks a bit odd.
Dorbmon commentedon Nov 2, 2021
I hope so for I need to do the same work haha.
Teddy-van-Jerry commentedon Dec 15, 2021
@Dorbmon I have successfully used a
ConvexMeshShapeto approximate the cylinder shape though the speed is not satisfactory.Here is the main code:
The full code is in this file of repo Dice Simulation.
patrikpatrik commentedon Dec 30, 2022
@Teddy-van-Jerry Hello, I tried your cylinder code but it seems to fall straight through my floor?
Teddy-van-Jerry commentedon Dec 30, 2022
@patrikpatrik Hi, it is quite a long time since I wrote this code. At that time, it was version
0.8.0. I am not sure whether this method is broken for0.9.0.Have you tried this simple code where there is also a floor to collide with. Some settings for the floor:
patrikpatrik commentedon Dec 30, 2022
Yeah I've tried creating a ground. I got it to work on the default convex cube method on the user manual page and a 3 sided equilateral triangle. Here is a snapshot of the cylinder in action. I turned down the
cylinderSidescount to 100 for testing, the camera is looking slightly down as the cylinder just passed through the floor. I had the debug lines enabled to see it. I also noticed there seems to be no mesh on the top and bottom ? Or maybe its just one big piece.https://ibb.co/LS67jC6
I've had this problem before where some of my objects passed through, could it be the winding order?
Teddy-van-Jerry commentedon Dec 30, 2022
I am not quite sure where the problem lies since in my code snippet vertices of each face are defined clockwise so as to satisfy the requirement.
About the mesh line on the top and bottom, I am not quite sure why. But according to the code itself, there are$N+2$ faces added to the cylinder, where $N$ is the number of
cylinderSides.Sorry I am not familiar with the graphic interface provided by the library (including how debug lines work). Probably the logic there is a bit different from doing the simulation from the terminal.
P.S. I am just about to sleep, so there can be delay of response.
:-)patrikpatrik commentedon Dec 30, 2022
Clockwise? But in the user manual @ 11.1.4 Convex Mesh Shape it states:
When you specify the vertices for each face of your convex mesh, be careful with their order. The vertices of a face must be specified in counter clockwise order as seen from the outside of your convex mesh.Teddy-van-Jerry commentedon Dec 31, 2022
Oops, sorry, I mean counter clockwise.
I reckon the idea behind the code snippet is relatively clear. Each face is built first, and then faces are added to the mesh according to the sequence of$N$ sides, top side and bottom side.
cykoder commentedon Jan 15, 2023
Proper non-hacky cylinder support would be appreciated