From 4392af3b3a8018ea7c5a89feaa2a1cb49e46e07c Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 16 Jan 2015 09:26:43 -0800 Subject: [PATCH] Remove pre-Bullet server-side EntityItem motion --- libraries/entities/src/EntityItem.cpp | 32 ++------------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 9cfb0c6c11..69cd16469e 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -691,15 +691,7 @@ void EntityItem::simulate(const quint64& now) { } } -#ifdef USE_BULLET_PHYSICS - // When Bullet is available we assume that "zero velocity" means "at rest" - // because of collision conditions this simulation does not know about - // so we don't fall in for the non-zero gravity case here. if (hasVelocity()) { -#else // !USE_BULLET_PHYSICS - if (hasVelocity() || hasGravity()) { -#endif // USE_BULLET_PHYSICS - // linear damping glm::vec3 velocity = getVelocity(); if (_damping > 0.0f) { @@ -733,14 +725,6 @@ void EntityItem::simulate(const quint64& now) { // handle bounces off the ground... We bounce at the distance to the bottom of our entity if (position.y <= getDistanceToBottomOfEntity()) { velocity = velocity * glm::vec3(1,-1,1); - -#ifndef USE_BULLET_PHYSICS - // if we've slowed considerably, then just stop moving, but only if no BULLET - if (glm::length(velocity) <= ENTITY_ITEM_EPSILON_VELOCITY_LENGTH) { - velocity = ENTITY_ITEM_ZERO_VEC3; - } -#endif // !USE_BULLET_PHYSICS - position.y = getDistanceToBottomOfEntity(); } @@ -756,14 +740,8 @@ void EntityItem::simulate(const quint64& now) { } } -#ifdef USE_BULLET_PHYSICS - // When Bullet is available we assume that it will tell us when velocities go to zero... -#else // !USE_BULLET_PHYSICS - // ... otherwise we help things come to rest by clamping small velocities. - if (glm::length(velocity) <= ENTITY_ITEM_EPSILON_VELOCITY_LENGTH) { - velocity = ENTITY_ITEM_ZERO_VEC3; - } -#endif // USE_BULLET_PHYSICS + // NOTE: we don't zero out very small velocities --> we rely on a remote Bullet simulation + // to tell us when the entity has stopped. // NOTE: the simulation should NOT set any DirtyFlags on this entity setPosition(position); // this will automatically recalculate our collision shape @@ -781,13 +759,7 @@ void EntityItem::simulate(const quint64& now) { } bool EntityItem::isMoving() const { -#ifdef USE_BULLET_PHYSICS - // When Bullet is available we assume that "zero velocity" means "at rest" - // because of collision conditions this simulation does not know about. return hasVelocity() || hasAngularVelocity(); -#else // !USE_BULLET_PHYSICS - return hasVelocity() || (hasGravity() && !isRestingOnSurface()) || hasAngularVelocity(); -#endif //USE_BULLET_PHYSICS } bool EntityItem::lifetimeHasExpired() const {