Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
gl-swept-sphere-triangle
Advanced tools
This code is is a reproduction of a gist from the creator of gl-matrix. This code implements a ellipsoid space swepth sphere collision detction algoritim from the paper "Improved Collision detection and Response" by Kasper Fauerby
npm install gl-swept-sphere-triangle
import { traceSphereTriangle, TraceInfo } from 'gl-swept-sphere-triangle';
var traceInfo = new TraceInfo();
var startPoint = [-10, 0, 0];
var endPoint = [10, 0, 0];
var radius = 0.5;
// Tracing a 0.5 radius sphere moving from X:-10 to X:10
traceInfo.resetTrace(startPoint, endPoint, radius);
// You really need to do a good broadphase triangle set reduction (ie: octree)
// to reduce the number of triangles you're colliding against. This is not a cheap
// test!
for(i in sceneTriangles) {
tri = sceneTriangles[i];
traceSphereTriangle(tri.verts[0], tri.verts[1], tri.verts[2], traceInfo);
}
if(traceInfo.collision) {
// This will get the position of the sphere when it collided with the closest triangle
traceInfo.getTraceEndpoint(endPoint);
// This is the point on the triangle where the sphere collided.
traceInfo.intersectPoint;
// You can use the above two values to generate an appropriate collision response.
}
The original gist uses a really old version of gl-matrix 1.3.8. Later versions of gl-matrix had non-backwards compatible API changes. This has old copy of gl-matrix has been hard coded in the code base. This was to evaluate if the gist code actually worked. Future iterations of this module will work to bring the dependencies up to speed and review potential performance gains.
This module has been updated to a modern version of gl-matrix
future road map will be purely optimization.
FAQs
gl swept spehere triangle collision
The npm package gl-swept-sphere-triangle receives a total of 1 weekly downloads. As such, gl-swept-sphere-triangle popularity was classified as not popular.
We found that gl-swept-sphere-triangle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.