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
115 return; // bail early if this entity is to be ignored...115 return; // bail early if this entity is to be ignored...
116 }116 }
117 117
118 // don't collide entities with unknown IDs,
119 if (!entityA->isKnownID()) {
120 return;
121 }
122
118 glm::vec3 penetration;123 glm::vec3 penetration;
119 EntityItem* entityB = NULL;124 EntityItem* entityB = NULL;
120 125
@@ -133,6 +138,11 @@ void EntityCollisionSystem::updateCollisionWithEntities(EntityItem* entityA) { · 12 unmodified lines
133 penetration = collision->_penetration;138 penetration = collision->_penetration;
134 entityB = static_cast<EntityItem*>(collision->_extraData);139 entityB = static_cast<EntityItem*>(collision->_extraData);
135 140
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
136 // NOTE: 'penetration' is the depth that 'entityA' overlaps 'entityB'. It points from A into B.146 // NOTE: 'penetration' is the depth that 'entityA' overlaps 'entityB'. It points from A into B.
137 glm::vec3 penetrationInTreeUnits = penetration / (float)(TREE_SCALE);147 glm::vec3 penetrationInTreeUnits = penetration / (float)(TREE_SCALE);
138 148
@@ -267,6 +277,12 @@ void EntityCollisionSystem::updateCollisionWithAvatars(EntityItem* entity) { · 128 unmodified lines
267}277}
268 278
269void EntityCollisionSystem::applyHardCollision(EntityItem* entity, const CollisionInfo& collisionInfo) {279void EntityCollisionSystem::applyHardCollision(EntityItem* entity, const CollisionInfo& collisionInfo) {
280
281 // don't collide entities with unknown IDs,
282 if (!entity->isKnownID()) {
283 return;
284 }
285
270 // HALTING_* params are determined using expected acceleration of gravity over some timescale. 286 // HALTING_* params are determined using expected acceleration of gravity over some timescale.
271 // This is a HACK for entities that bounce in a 1.0 gravitational field and should eventually be made more universal.287 // This is a HACK for entities that bounce in a 1.0 gravitational field and should eventually be made more universal.
272 const float HALTING_ENTITY_PERIOD = 0.0167f; // ~1/60th of a second288 const float HALTING_ENTITY_PERIOD = 0.0167f; // ~1/60th of a second