New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

goblinphysics

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

goblinphysics - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

src/classes/Utils/CollisionUtils.js

2

package.json
{
"name": "goblinphysics",
"version": "0.8.0",
"version": "0.8.1",
"description": "3D physics engine for JavaScript",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/chandlerprall/GoblinPhysics",

@@ -80,38 +80,7 @@ /**

if ( object_a._mass === Infinity && object_b._mass === Infinity ) {
// Two static objects aren't considered to be in contact
continue;
}
// Check collision masks
if ( object_a.collision_mask !== 0 ) {
if ( ( object_a.collision_mask & 1 ) === 0 ) {
// object_b must not be in a matching group
if ( ( object_a.collision_mask & object_b.collision_groups ) !== 0 ) {
continue;
}
} else {
// object_b must be in a matching group
if ( ( object_a.collision_mask & object_b.collision_groups ) === 0 ) {
continue;
}
if( Goblin.CollisionUtils.canBodiesCollide( object_a, object_b ) ) {
if ( object_a.aabb.intersects( object_b.aabb ) ) {
this.collision_pairs.push( [ object_b, object_a ] );
}
}
if ( object_b.collision_mask !== 0 ) {
if ( ( object_b.collision_mask & 1 ) === 0 ) {
// object_a must not be in a matching group
if ( ( object_b.collision_mask & object_a.collision_groups ) !== 0 ) {
continue;
}
} else {
// object_a must be in a matching group
if ( ( object_b.collision_mask & object_a.collision_groups ) === 0 ) {
continue;
}
}
}
if ( object_a.aabb.intersects( object_b.aabb ) ) {
this.collision_pairs.push( [ object_b, object_a ] );
}
}

@@ -141,3 +110,3 @@ }

if ( this.mightIntersect( object_a, object_b ) ) {
if ( object_a.aabb.intersects( object_b.aabb ) ) {
intersections.push( object_b );

@@ -144,0 +113,0 @@ }

@@ -84,3 +84,3 @@ (function(){

incrementOverlaps: function( body_a, body_b ) {
if ( body_a._mass === Infinity && body_b._mass === Infinity ) {
if( !Goblin.CollisionUtils.canBodiesCollide( body_a, body_b ) ) {
return;

@@ -147,3 +147,3 @@ }

// body was already added, find & remove
var next, previous;
var next, prev;
var marker = this.markers_x.first;

@@ -153,15 +153,15 @@ while ( marker ) {

next = marker.next;
previous = marker.previous;
prev = marker.prev;
if ( next != null ) {
next.previous = previous;
if ( previous != null ) {
previous.next = next;
next.prev = prev;
if ( prev != null ) {
prev.next = next;
}
} else {
this.markers_x.last = previous;
this.markers_x.last = prev;
}
if ( previous != null ) {
previous.next = next;
if ( prev != null ) {
prev.next = next;
if ( next != null ) {
next.previous = previous;
next.prev = prev;
}

@@ -179,15 +179,15 @@ } else {

next = marker.next;
previous = marker.previous;
prev = marker.prev;
if ( next != null ) {
next.previous = previous;
if ( previous != null ) {
previous.next = next;
next.prev = prev;
if ( prev != null ) {
prev.next = next;
}
} else {
this.markers_y.last = previous;
this.markers_y.last = prev;
}
if ( previous != null ) {
previous.next = next;
if ( prev != null ) {
prev.next = next;
if ( next != null ) {
next.previous = previous;
next.prev = prev;
}

@@ -205,15 +205,15 @@ } else {

next = marker.next;
previous = marker.previous;
prev = marker.prev;
if ( next != null ) {
next.previous = previous;
if ( previous != null ) {
previous.next = next;
next.prev = prev;
if ( prev != null ) {
prev.next = next;
}
} else {
this.markers_z.last = previous;
this.markers_z.last = prev;
}
if ( previous != null ) {
previous.next = next;
if ( prev != null ) {
prev.next = next;
if ( next != null ) {
next.previous = previous;
next.prev = prev;
}

@@ -360,3 +360,6 @@ } else {

intersectsWith: function( body ) {
return this.collision_pairs.filter(function( pair ){
this.addBody( body );
this.update();
var possibilities = this.collision_pairs.filter(function( pair ){
if ( pair[0] === body || pair[1] === body ) {

@@ -366,3 +369,8 @@ return true;

return false;
}).map(function( pair ){
return pair[0] === body ? pair[1] : pair[0];
});
this.removeBody( body );
return possibilities;
},

@@ -369,0 +377,0 @@

@@ -117,3 +117,3 @@ Goblin.Vector3 = function( x, y, z ) {

var a, k;
if ( Math.abs( this.z ) > 0.7071067811865475 ) {
if ( Math.abs( this.z ) > 0.7071067811865476 ) {
// choose p in y-z plane

@@ -120,0 +120,0 @@ a = -this.y * this.y + this.z * this.z;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc