History

don't collide with entities with unknown IDs

ZappoMan committed 12 years ago

Commit 48071bb1 parent 48735281 file · +16 −0Browse files

Showing the changes to libraries/entities/src/EntityCollisionSystem.cpp (1 of 1 file). Show all

Unified · Split

libraries/entities/src/EntityCollisionSystem.cpp+16−0
@@ -115,6 +115,11 @@ void EntityCollisionSystem::updateCollisionWithEntities(EntityItem* entityA) { · 114 unmodified lines
115115 return; // bail early if this entity is to be ignored...
116116 }
117117
118+ // don't collide entities with unknown IDs,
119+ if (!entityA->isKnownID()) {
120+ return;
121+ }
122+
118123 glm::vec3 penetration;
119124 EntityItem* entityB = NULL;
120125
@@ -133,6 +138,11 @@ void EntityCollisionSystem::updateCollisionWithEntities(EntityItem* entityA) { · 12 unmodified lines
133138 penetration = collision->_penetration;
134139 entityB = static_cast<EntityItem*>(collision->_extraData);
135140
141+ // don't collide entities with unknown IDs,
142+ if (!entityB->isKnownID()) {
143+ continue; // skip this loop pass if the entity has an unknown ID
144+ }
145+
136146 // NOTE: 'penetration' is the depth that 'entityA' overlaps 'entityB'. It points from A into B.
137147 glm::vec3 penetrationInTreeUnits = penetration / (float)(TREE_SCALE);
138148
@@ -267,6 +277,12 @@ void EntityCollisionSystem::updateCollisionWithAvatars(EntityItem* entity) { · 128 unmodified lines
267277 }
268278
269279 void EntityCollisionSystem::applyHardCollision(EntityItem* entity, const CollisionInfo& collisionInfo) {
280+
281+ // don't collide entities with unknown IDs,
282+ if (!entity->isKnownID()) {
283+ return;
284+ }
285+
270286 // HALTING_* params are determined using expected acceleration of gravity over some timescale.
271287 // This is a HACK for entities that bounce in a 1.0 gravitational field and should eventually be made more universal.
272288 const float HALTING_ENTITY_PERIOD = 0.0167f; // ~1/60th of a second