Merge pull request #3561 from ZappoMan/master

don't collide with entities with unknown IDs
This commit is contained in:
Clément Brisset 2014-10-08 15:31:48 -07:00
commit b5b7cdbc71

View file

@ -115,6 +115,11 @@ void EntityCollisionSystem::updateCollisionWithEntities(EntityItem* entityA) {
return; // bail early if this entity is to be ignored...
}
// don't collide entities with unknown IDs,
if (!entityA->isKnownID()) {
return;
}
glm::vec3 penetration;
EntityItem* entityB = NULL;
@ -133,6 +138,11 @@ void EntityCollisionSystem::updateCollisionWithEntities(EntityItem* entityA) {
penetration = collision->_penetration;
entityB = static_cast<EntityItem*>(collision->_extraData);
// don't collide entities with unknown IDs,
if (!entityB->isKnownID()) {
continue; // skip this loop pass if the entity has an unknown ID
}
// NOTE: 'penetration' is the depth that 'entityA' overlaps 'entityB'. It points from A into B.
glm::vec3 penetrationInTreeUnits = penetration / (float)(TREE_SCALE);
@ -267,6 +277,12 @@ void EntityCollisionSystem::updateCollisionWithAvatars(EntityItem* entity) {
}
void EntityCollisionSystem::applyHardCollision(EntityItem* entity, const CollisionInfo& collisionInfo) {
// don't collide entities with unknown IDs,
if (!entity->isKnownID()) {
return;
}
// HALTING_* params are determined using expected acceleration of gravity over some timescale.
// This is a HACK for entities that bounce in a 1.0 gravitational field and should eventually be made more universal.
const float HALTING_ENTITY_PERIOD = 0.0167f; // ~1/60th of a second