A calculation method for a real-time physical engine enhancement based on a neural network, executed by at least one processor and a memory, comprising the following steps:
- a multi-layer and multi-surface pre-collision shell constructing step:
- dynamically constructing, by the processor, a multi-layer and multi-surface pre-collision shell data structure stored in the memory, the pre-collision shell comprising a plurality of three-dimensional matrices corresponding to concave and convex surface vertices of an object to be subjected to collision detection;
- wherein the constructing of the pre-collision shell further comprises:
- determining, for a group of neighboring vertices, a Euclidean distance threshold Vm1 based on a maximum Euclidean distance between vertices in the group, and merging vertices within the Euclidean distance threshold Vm1 into a representative vertex such that a plurality of neighboring vertices are reduced to a reduced number of representative vertices to form a first-layer pre-collision shell;
- wherein additional shell layers are generated by increasing the Euclidean distance threshold to Vm2 greater than Vm1 to merge a greater number of vertices, thereby forming a multi-layer structure having progressively reduced vertex density;
- a relation matrix acquisition step:
- obtaining, by the processor, an initial collision detection correspondence matrix representing Euclidean distance relationships between vertices of the multi-layer and multi-surface pre-collision shell;
- and
- a screening and determining step:
- setting a collision detection condition, inputting, by the processor, one or more collision parameters including vertex distance change, surface type, and relative velocity into a trained neural network stored in the memory, and determining whether a collision condition satisfies a safety condition after screening;
- wherein the trained neural network generates an output Vm1 value indicating whether a predicted vertex-to-vertex distance change violates a predefined safety distance;
- wherein when the collision condition satisfies the safety condition, the collision detection correspondence matrix is maintained without update;
- when the collision condition does not satisfy the safety condition, the collision detection correspondence matrix is updated based on the output of the trained neural network;
- the multi-layer and multi-surface pre-collision shell constructing step is selectively triggered according to the updated collision detection correspondence matrix to reconstruct the multi-layer and multi-surface pre-collision shell;
- wherein selective reconstruction reduces real-time collision-detection computation relative to reconstructing the pre-collision shell at every simulation time step;
- and
- wherein the trained neural network is trained by:
- generating a training dataset comprising a plurality of surface segments of objects having different surface types and geometries;
- iteratively calculating candidate Euclidean distance threshold values Vm1 corresponding to vertex groupings of the surface segments;
- performing convergence-based optimization to determine a best-fit Euclidean distance threshold Vm1 associated with each surface type;
- and training the neural network to learn a relationship between surface characteristics and corresponding best-fit Euclidean distance threshold values such that the trained neural network outputs an assigned Vm1 for use in constructing the pre-collision shell.