mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-26 12:41:40 +00:00
buff nuke slightly
This commit is contained in:
parent
1ddb981702
commit
720a92df52
3 changed files with 37 additions and 13 deletions
|
|
@ -348,8 +348,8 @@ class DtsObject extends GameObject {
|
||||||
for (pt in mesh.vertices)
|
for (pt in mesh.vertices)
|
||||||
boundthing.addPoint(new h3d.col.Point(-pt.x, pt.y, pt.z));
|
boundthing.addPoint(new h3d.col.Point(-pt.x, pt.y, pt.z));
|
||||||
}
|
}
|
||||||
boundthing.addPoint(new h3d.col.Point(this.dts.bounds.minX, this.dts.bounds.minY, this.dts.bounds.minZ));
|
boundthing.addPoint(new h3d.col.Point(-this.dts.bounds.minX, this.dts.bounds.minY, this.dts.bounds.minZ));
|
||||||
boundthing.addPoint(new h3d.col.Point(this.dts.bounds.maxX, this.dts.bounds.maxY, this.dts.bounds.maxZ));
|
boundthing.addPoint(new h3d.col.Point(-this.dts.bounds.maxX, this.dts.bounds.maxY, this.dts.bounds.maxZ));
|
||||||
this.boundingCollider = new BoxCollisionEntity(boundthing, cast this);
|
this.boundingCollider = new BoxCollisionEntity(boundthing, cast this);
|
||||||
this.boundingCollider.setTransform(this.getTransform());
|
this.boundingCollider.setTransform(this.getTransform());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ class Marble extends GameObject {
|
||||||
public var contactEntities:Array<CollisionEntity> = [];
|
public var contactEntities:Array<CollisionEntity> = [];
|
||||||
|
|
||||||
var queuedContacts:Array<CollisionInfo> = [];
|
var queuedContacts:Array<CollisionInfo> = [];
|
||||||
var appliedImpulses:Array<Vector> = [];
|
var appliedImpulses:Array<{impulse:Vector, contactImpulse:Bool}> = [];
|
||||||
|
|
||||||
public var heldPowerup:PowerUp;
|
public var heldPowerup:PowerUp;
|
||||||
public var lastContactNormal:Vector;
|
public var lastContactNormal:Vector;
|
||||||
|
|
@ -1498,11 +1498,14 @@ class Marble extends GameObject {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tsi = Collision.TriangleSphereIntersection(testTri.v[0], testTri.v[1], testTri.v[2], testTri.n, position, radius, testTri.edge,
|
// Intersection with plane of testTri and current position
|
||||||
testTri.concavity);
|
var t = (testTri.v[0].sub(position)).dot(testTri.n) / testTri.n.lengthSq();
|
||||||
if (tsi.result) {
|
var intersect = position.add(testTri.n.multiply(t));
|
||||||
var separatingDistance = position.sub(tsi.point).normalized();
|
|
||||||
var distToContactPlane = tsi.point.distance(position);
|
var tsi = Collision.PointInTriangle(intersect, testTri.v[0], testTri.v[1], testTri.v[2]);
|
||||||
|
if (tsi) {
|
||||||
|
var separatingDistance = position.sub(intersect).normalized();
|
||||||
|
var distToContactPlane = intersect.distance(position);
|
||||||
if (radius - 0.005 - distToContactPlane > 0.0001) {
|
if (radius - 0.005 - distToContactPlane > 0.0001) {
|
||||||
// Nudge to the surface of the contact plane
|
// Nudge to the surface of the contact plane
|
||||||
Debug.drawTriangle(testTri.v[0], testTri.v[1], testTri.v[2]);
|
Debug.drawTriangle(testTri.v[0], testTri.v[1], testTri.v[2]);
|
||||||
|
|
@ -1512,6 +1515,20 @@ class Marble extends GameObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// var tsi = Collision.TriangleSphereIntersection(testTri.v[0], testTri.v[1], testTri.v[2], testTri.n, position, radius, testTri.edge,
|
||||||
|
// testTri.concavity);
|
||||||
|
// if (tsi.result) {
|
||||||
|
// var separatingDistance = position.sub(tsi.point).normalized();
|
||||||
|
// var distToContactPlane = tsi.point.distance(position);
|
||||||
|
// if (radius - 0.005 - distToContactPlane > 0.0001) {
|
||||||
|
// // Nudge to the surface of the contact plane
|
||||||
|
// Debug.drawTriangle(testTri.v[0], testTri.v[1], testTri.v[2]);
|
||||||
|
// Debug.drawSphere(position, radius);
|
||||||
|
// position = position.add(separatingDistance.multiply(radius - distToContactPlane - 0.005));
|
||||||
|
// resolved++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// var distToContactPlane = position.dot(contact.normal) - contact.point.dot(contact.normal);
|
// var distToContactPlane = position.dot(contact.normal) - contact.point.dot(contact.normal);
|
||||||
}
|
}
|
||||||
if (resolved == 0 && prevResolved == 0)
|
if (resolved == 0 && prevResolved == 0)
|
||||||
|
|
@ -1583,7 +1600,10 @@ class Marble extends GameObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (impulse in appliedImpulses) {
|
for (impulse in appliedImpulses) {
|
||||||
this.velocity = this.velocity.add(impulse);
|
this.velocity = this.velocity.add(impulse.impulse);
|
||||||
|
if (m.jump && impulse.contactImpulse) {
|
||||||
|
this.velocity = this.velocity.add(impulse.impulse.normalized().multiply(this._jumpImpulse));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
appliedImpulses = [];
|
appliedImpulses = [];
|
||||||
|
|
||||||
|
|
@ -1866,8 +1886,8 @@ class Marble extends GameObject {
|
||||||
this.level.blastAmount = 0;
|
this.level.blastAmount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyImpulse(impulse:Vector) {
|
public function applyImpulse(impulse:Vector, contactImpulse:Bool = false) {
|
||||||
this.appliedImpulses.push(impulse);
|
this.appliedImpulses.push({impulse: impulse, contactImpulse: contactImpulse});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enableSuperBounce(time:Float) {
|
public function enableSuperBounce(time:Float) {
|
||||||
|
|
|
||||||
|
|
@ -135,11 +135,15 @@ class Nuke extends DtsObject {
|
||||||
|
|
||||||
var marble = this.level.marble;
|
var marble = this.level.marble;
|
||||||
var minePos = this.getAbsPos().getPosition();
|
var minePos = this.getAbsPos().getPosition();
|
||||||
|
var dtsCenter = this.dts.bounds.center();
|
||||||
|
// dtsCenter.x = -dtsCenter.x;
|
||||||
|
// minePos.x += dtsCenter.x;
|
||||||
|
// minePos.y += dtsCenter.y;
|
||||||
|
// minePos.z += dtsCenter.z;
|
||||||
var off = marble.getAbsPos().getPosition().sub(minePos);
|
var off = marble.getAbsPos().getPosition().sub(minePos);
|
||||||
|
|
||||||
var force = computeExplosionForce(off);
|
var force = computeExplosionForce(off);
|
||||||
|
marble.applyImpulse(force, true);
|
||||||
marble.applyImpulse(force);
|
|
||||||
|
|
||||||
// for (collider in this.colliders) {
|
// for (collider in this.colliders) {
|
||||||
// var hull:CollisionHull = cast collider;
|
// var hull:CollisionHull = cast collider;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue