mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fixed morph being really slow
This commit is contained in:
parent
591bd0a2d5
commit
cfd1a6a139
4 changed files with 8 additions and 7 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,8 +46,8 @@ 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {foundEntities: foundEntities, contacts: contacts};
|
return {foundEntities: foundEntities, contacts: contacts};
|
||||||
|
|
@ -82,8 +83,8 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue