mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix dumb lag issue
This commit is contained in:
parent
d86af0b31a
commit
27a6f964a6
6 changed files with 29 additions and 18 deletions
|
|
@ -1287,6 +1287,7 @@ class Marble extends GameObject {
|
|||
this.setRotationQuat(quat);
|
||||
|
||||
var totMatrix = quat.toMatrix();
|
||||
newPos.w = 1; // Fix shit blowing up
|
||||
totMatrix.setPosition(newPos);
|
||||
|
||||
this.setPosition(newPos.x, newPos.y, newPos.z);
|
||||
|
|
|
|||
|
|
@ -1311,7 +1311,11 @@ class MarbleWorld extends Scheduler {
|
|||
playGui.setCenterText('outofbounds');
|
||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/whoosh.wav', ResourceLoader.getAudio, this.soundResources));
|
||||
// if (this.replay.mode != = 'playback')
|
||||
this.schedule(this.timeState.currentAttemptTime + 2, () -> this.restart());
|
||||
this.schedule(this.timeState.currentAttemptTime + 2, () -> {
|
||||
playGui.setCenterText('none');
|
||||
return null;
|
||||
});
|
||||
this.schedule(this.timeState.currentAttemptTime + 2.5, () -> this.restart());
|
||||
}
|
||||
|
||||
public function setCursorLock(enabled:Bool) {
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ class CollisionEntity implements IOctreeObject {
|
|||
var sphereBounds = new Bounds();
|
||||
var localPos = position.clone();
|
||||
localPos.transform(invMatrix);
|
||||
sphereBounds.addSpherePos(position.x, position.y, position.z, radius * 1.1);
|
||||
sphereBounds.transform(invMatrix);
|
||||
// sphereBounds.addSpherePos(position.x, position.y, position.z, radius * 1.1);
|
||||
// sphereBounds.transform(invMatrix);
|
||||
sphereBounds.addSpherePos(localPos.x, localPos.y, localPos.z, radius * 1.1);
|
||||
var surfaces = bvh == null ? octree.boundingSearch(sphereBounds).map(x -> cast x) : bvh.boundingSearch(sphereBounds);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,13 +73,12 @@ class Grid {
|
|||
var hash = hashVector(i, j, k);
|
||||
if (this.map.exists(hash)) {
|
||||
var surfs = this.map.get(hash);
|
||||
var actualsurfs = surfs.map(x -> this.surfaces[x]);
|
||||
for (surf in actualsurfs) {
|
||||
if (surf.key)
|
||||
for (surf in surfs) {
|
||||
if (surfaces[surf].key)
|
||||
continue;
|
||||
if (searchbox.containsBounds(surf.boundingBox) || searchbox.collide(surf.boundingBox)) {
|
||||
foundSurfaces.push(surf);
|
||||
surf.key = true;
|
||||
if (searchbox.containsBounds(surfaces[surf].boundingBox) || searchbox.collide(surfaces[surf].boundingBox)) {
|
||||
foundSurfaces.push(surfaces[surf]);
|
||||
surfaces[surf].key = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class Cylinder implements GJKShape {
|
|||
public function support(dir:Vector) {
|
||||
var axis = p2.sub(p1);
|
||||
var v = axis.dot(dir) > 0 ? p2 : p1;
|
||||
var rejection = dir.sub(axis.multiply(dir.dot(axis) / (axis.dot(axis) * dir.dot(dir)))).normalized().multiply(radius);
|
||||
var rejection = dir.sub(axis.multiply(dir.dot(axis) / (axis.dot(axis)))).normalized().multiply(radius);
|
||||
return v.add(rejection);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import h3d.mat.Texture;
|
|||
class EndPad extends DtsObject {
|
||||
var fireworks:Array<Firework> = [];
|
||||
|
||||
var finishCollider:Cylinder;
|
||||
var finishCollider:ConvexHull;
|
||||
var finishBounds:Bounds;
|
||||
var inFinish:Bool = false;
|
||||
|
||||
|
|
@ -75,12 +75,19 @@ class EndPad extends DtsObject {
|
|||
vertices.push(new Vector(x * radius * this.scaleX, (i != 0 ? 4.8 : 0) * 1, z * radius * this.scaleY));
|
||||
}
|
||||
}
|
||||
finishCollider = new Cylinder();
|
||||
finishCollider.p1 = this.getAbsPos().getPosition();
|
||||
finishCollider.p2 = finishCollider.p1.clone();
|
||||
var vertDir = this.getAbsPos().up();
|
||||
finishCollider.p2 = finishCollider.p2.add(vertDir.multiply(height));
|
||||
finishCollider.radius = radius * this.scaleY;
|
||||
// var m = new h3d.prim.Cylinder(64, radius, height);
|
||||
// m.addNormals();
|
||||
// m.addUVs();
|
||||
// var cmesh = new h3d.scene.Mesh(m);
|
||||
// cmesh.setTransform(this.getAbsPos());
|
||||
// MarbleGame.instance.scene.addChild(cmesh);
|
||||
finishCollider = new ConvexHull(vertices);
|
||||
// finishCollider = new Cylinder();
|
||||
// finishCollider.p1 = this.getAbsPos().getPosition();
|
||||
// finishCollider.p2 = finishCollider.p1.clone();
|
||||
// var vertDir = this.getAbsPos().up();
|
||||
// finishCollider.p2 = finishCollider.p2.add(vertDir.multiply(height));
|
||||
// finishCollider.radius = radius;
|
||||
|
||||
finishBounds = new Bounds();
|
||||
for (vert in vertices)
|
||||
|
|
@ -93,7 +100,7 @@ class EndPad extends DtsObject {
|
|||
var tform = this.getAbsPos().clone();
|
||||
tform.prependRotation(Math.PI / 2, 0, 0);
|
||||
|
||||
// finishCollider.transform = tform;
|
||||
finishCollider.transform = tform;
|
||||
|
||||
finishBounds.transform(tform);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue