mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-05 22:02:17 +02:00
gun.js correctly deletes voxel again on collision
This commit is contained in:
parent
ddb8ac9ad4
commit
fe1123ea97
1 changed files with 7 additions and 8 deletions
|
@ -152,11 +152,10 @@ function particleCollisionWithVoxel(particle, voxel, collision) {
|
||||||
var position = particleProperties.position;
|
var position = particleProperties.position;
|
||||||
Particles.deleteParticle(particle);
|
Particles.deleteParticle(particle);
|
||||||
// Make a hole in this voxel
|
// Make a hole in this voxel
|
||||||
Vec3.print("penetration", collision.penetration);
|
//Vec3.print("voxel penetration", collision.penetration);
|
||||||
Vec3.print("contactPoint", collision.contactPoint);
|
//Vec3.print("voxel contactPoint", collision.contactPoint);
|
||||||
Voxels.eraseVoxel(contactPoint.x, contactPoint.y, contactPoint.z, HOLE_SIZE);
|
Voxels.eraseVoxel(collision.contactPoint.x, collision.contactPoint.y, collision.contactPoint.z, HOLE_SIZE);
|
||||||
Voxels.eraseVoxel(position.x, position.y, position.z, HOLE_SIZE);
|
audioOptions.position = collision.contactPoint;
|
||||||
audioOptions.position = Vec3.sum(Camera.getPosition(), Quat.getFront(Camera.getOrientation()));
|
|
||||||
Audio.playSound(impactSound, audioOptions);
|
Audio.playSound(impactSound, audioOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,9 +170,9 @@ function particleCollisionWithParticle(particle1, particle2, collision) {
|
||||||
// Record shot time
|
// Record shot time
|
||||||
var endTime = new Date();
|
var endTime = new Date();
|
||||||
var msecs = endTime.valueOf() - shotTime.valueOf();
|
var msecs = endTime.valueOf() - shotTime.valueOf();
|
||||||
print("hit, msecs = " + msecs);
|
//print("hit, msecs = " + msecs);
|
||||||
Vec3.print("penetration = ", collision.penetration);
|
//Vec3.print("penetration = ", collision.penetration);
|
||||||
Vec3.print("contactPoint = ", collision.contactPoint);
|
//Vec3.print("contactPoint = ", collision.contactPoint);
|
||||||
Particles.deleteParticle(particle1);
|
Particles.deleteParticle(particle1);
|
||||||
Particles.deleteParticle(particle2);
|
Particles.deleteParticle(particle2);
|
||||||
// play the sound near the camera so the shooter can hear it
|
// play the sound near the camera so the shooter can hear it
|
||||||
|
|
Loading…
Reference in a new issue