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() {
var tform = this.collider.transform;
var tform = this.collider.transform.clone();
tform.setPosition(this.currentPosition);
this.setTransform(tform);
this.collider.setTransform(tform);

View file

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

View file

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

View file

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