fixed morph being really slow

This commit is contained in:
RandomityGuy 2022-11-12 18:30:33 +05:30
parent 591bd0a2d5
commit cfd1a6a139
4 changed files with 8 additions and 7 deletions

View file

@ -243,7 +243,7 @@ class PathedInterior extends InteriorObject {
} }
function updatePosition() { function updatePosition() {
var tform = this.collider.transform; var tform = this.collider.transform.clone();
tform.setPosition(this.currentPosition); tform.setPosition(this.currentPosition);
this.setTransform(tform); this.setTransform(tform);
this.collider.setTransform(tform); this.collider.setTransform(tform);

View file

@ -63,7 +63,7 @@ class CollisionEntity implements IOctreeObject {
public function setTransform(transform:Matrix) { public function setTransform(transform:Matrix) {
if (this.transform == transform) if (this.transform == transform)
return; return;
this.transform = transform; this.transform.load(transform);
this.invTransform = transform.getInverse(); this.invTransform = transform.getInverse();
generateBoundingBox(); generateBoundingBox();
} }

View file

@ -1,5 +1,6 @@
package collision; package collision;
import src.MarbleGame;
import src.TimeState; import src.TimeState;
import h3d.col.Bounds; import h3d.col.Bounds;
import h3d.col.Sphere; import h3d.col.Sphere;
@ -45,7 +46,7 @@ class CollisionWorld {
for (obj in dynamicEntities) { for (obj in dynamicEntities) {
if (obj != spherecollision) { if (obj != spherecollision) {
// if (obj.boundingBox.collide(box) && obj.go.isCollideable) if (obj.boundingBox.collide(box) && obj.go.isCollideable)
contacts = contacts.concat(obj.sphereIntersection(spherecollision, timeState)); contacts = contacts.concat(obj.sphereIntersection(spherecollision, timeState));
} }
} }
@ -82,7 +83,7 @@ class CollisionWorld {
public function boundingSearch(bounds:Bounds) { public function boundingSearch(bounds:Bounds) {
var contacts = this.octree.boundingSearch(bounds).map(x -> cast(x, CollisionEntity)); var contacts = this.octree.boundingSearch(bounds).map(x -> cast(x, CollisionEntity));
for (obj in dynamicEntities) { for (obj in dynamicEntities) {
// if (obj.boundingBox.collide(bounds)) if (obj.boundingBox.collide(bounds))
contacts.push(obj); contacts.push(obj);
} }
return contacts; return contacts;

View file

@ -31,7 +31,7 @@ class ConvexHull implements GJKShape {
public function setTransform(matrix:Matrix):Void { public function setTransform(matrix:Matrix):Void {
if (this.transform != matrix) { if (this.transform != matrix) {
this.transform = matrix; this.transform.load(matrix);
this._centercache = null; this._centercache = null;
} }
} }