At first glance, this is a very simple mechanism. Put a convex-convex contact joint between the cam and tappet and a spring force to restore the tappet to the original position. However, this leads to a complete overhaul of my collision detection scheme. The problem is between the valve seat and valve. I want a more realistic concave-convex type collision between them. How to handle a concave geometry? I have treaded the territory of signed distance map before and accumulated enough frustration. In addition, it does not fit my fundamental work on the feature-based geometry. Convex decomposition? Some geometry is inherently concave, such as the inside of a cylinder wall. Moreover, I am reluctant to invest even more time on the uncharted sea of collision detection. I need something simple and effective.
My solution is to have three types of geometry:
- Convex – a convex polytope or a convex surface patch that is not limited to a polyhedron.
- Complex – a triangle soup. A concept that is easy for me to grasp when I studied RAPID.
- Composite – a thing that is composed of convex and complex.
There is no primitive geometry such as box, sphere, or cylinder. Everything is built from triangle meshes. A non-polyhedron convex opens the floodgate to bugs roaming around my code. I spent a lot of time debugging but I think there is still some dormant bugs which I have not uncovered. There is no automatic schemes for convex decomposition. The user is responsible for identifying the convex parts in a composite. If it is very difficult to identify a part in a composite, that part deserves to be called complex. These geometries are supported by three colliders:
- ConvexConvexCollider – the fundamental element in the hierarchy that uses DEEP. Free edges cause me the most trouble.
- ComplexConvexCollider – the triangle soup is culled by an AABB tree. A single triangle and a convex collision is handled by ConvexConvexCollider.
- CompositeCompositeCollider – peels down the hierarchy to employ ConvexConvexCollider and ComplexConvexCollider.
Complex and complex collision is not allowed since I don’t know how to determine the penetration depth between two colliding objects when they are represented by two triangle soups. I am aware that ODE trimesh manages to do just that but it is not very reliable.
The model geometry is taken from ADAMS Engine, but the spring geometry is constructed by java code from j3d.org. Obviously, there is more to accurately model a spring than just to assign the spring stiffness. I didn’t include the spring details in the model and it seems lack of accuracy. But that work is left for the future improvement.