minimum entity dimension

This commit is contained in:
SamGondelman 2018-04-12 14:12:52 -07:00
parent ef133806be
commit 9f3a431c5d
2 changed files with 3 additions and 4 deletions

View file

@ -1688,7 +1688,8 @@ void EntityItem::setScaledDimensions(const glm::vec3& value) {
}
void EntityItem::setUnscaledDimensions(const glm::vec3& value) {
glm::vec3 newDimensions = glm::max(value, glm::vec3(0.0f)); // can never have negative dimensions
const float MIN_ENTITY_DIMENSION = 0.01f; // this value cubed should == MIN_VOLUME in setMass
glm::vec3 newDimensions = glm::max(value, glm::vec3(MIN_ENTITY_DIMENSION));
if (getUnscaledDimensions() != newDimensions) {
withWriteLock([&] {
_unscaledDimensions = newDimensions;

View file

@ -182,9 +182,7 @@ const float SCALE_CHANGE_EPSILON = 0.0000001f;
void Model::setScaleInternal(const glm::vec3& scale) {
if (glm::distance(_scale, scale) > SCALE_CHANGE_EPSILON) {
_scale = scale;
if (_scale.x == 0.0f || _scale.y == 0.0f || _scale.z == 0.0f) {
assert(false);
}
assert(_scale.x != 0.0f && scale.y != 0.0f && scale.z != 0.0f);
simulate(0.0f, true);
}
}