internal void GenerateColliders(float collisionReductionFactor, List <ICollider> colliders) { var mesh = _meshGenerator.GetMesh(); if (mesh == null) { Logger.Warn($"Primitive {_meshGenerator.name} did not return a mesh for collider generation."); return; } mesh = mesh.Transform(_meshGenerator.GetTransformationMatrix()); var reducedVertices = math.max( (uint)MathF.Pow(mesh.Vertices.Length, MathF.Clamp(1f - collisionReductionFactor, 0f, 1f) * 0.25f + 0.75f), 420u //!! 420 = magic ); if (reducedVertices < mesh.Vertices.Length) { mesh = ComputeReducedMesh(mesh, reducedVertices); } ColliderUtils.GenerateCollidersFromMesh(mesh, _api.GetColliderInfo(), colliders); }
public RenderVertex3D[] GetCentralCurve(float acc = -1.0f) { float accuracy; // as solid ramps are rendered into the static buffer, always use maximum precision if (acc != -1.0) { accuracy = acc; // used for hit shape calculation, always! } else { // var mat = table.GetMaterial(_data.Material); // if (mat == null || !mat.IsOpacityActive) { accuracy = 10.0f; // } else { // accuracy = table.GetDetailLevel(); // } } // min = 4 (highest accuracy/detail level), max = 4 * 10^(10/1.5) = ~18.000.000 (lowest accuracy/detail level) accuracy = 4.0f * MathF.Pow(10.0f, (10.0f - accuracy) * (1.0f / 1.5f)); return(DragPoint.GetRgVertex <RenderVertex3D, CatmullCurve3DCatmullCurveFactory>(_data.DragPoints, false, accuracy)); }