remove velocity restrictions on SHAPE_TYPE_STATIC_MESH

This commit is contained in:
Andrew Meadows 2019-02-15 16:59:18 -08:00
parent 304f993391
commit 2fdc9bce77

View file

@ -1912,11 +1912,6 @@ void EntityItem::setRotation(glm::quat rotation) {
void EntityItem::setVelocity(const glm::vec3& value) { void EntityItem::setVelocity(const glm::vec3& value) {
glm::vec3 velocity = getLocalVelocity(); glm::vec3 velocity = getLocalVelocity();
if (velocity != value) { if (velocity != value) {
if (getShapeType() == SHAPE_TYPE_STATIC_MESH) {
if (velocity != Vectors::ZERO) {
setLocalVelocity(Vectors::ZERO);
}
} else {
float speed = glm::length(value); float speed = glm::length(value);
if (!glm::isnan(speed)) { if (!glm::isnan(speed)) {
const float MIN_LINEAR_SPEED = 0.001f; const float MIN_LINEAR_SPEED = 0.001f;
@ -1933,7 +1928,6 @@ void EntityItem::setVelocity(const glm::vec3& value) {
} }
} }
} }
}
void EntityItem::setDamping(float value) { void EntityItem::setDamping(float value) {
auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING);
@ -1948,9 +1942,6 @@ void EntityItem::setDamping(float value) {
void EntityItem::setGravity(const glm::vec3& value) { void EntityItem::setGravity(const glm::vec3& value) {
withWriteLock([&] { withWriteLock([&] {
if (_gravity != value) { if (_gravity != value) {
if (getShapeType() == SHAPE_TYPE_STATIC_MESH) {
_gravity = Vectors::ZERO;
} else {
float magnitude = glm::length(value); float magnitude = glm::length(value);
if (!glm::isnan(magnitude)) { if (!glm::isnan(magnitude)) {
const float MAX_ACCELERATION_OF_GRAVITY = 10.0f * 9.8f; // 10g const float MAX_ACCELERATION_OF_GRAVITY = 10.0f * 9.8f; // 10g
@ -1962,16 +1953,12 @@ void EntityItem::setGravity(const glm::vec3& value) {
_flags |= Simulation::DIRTY_LINEAR_VELOCITY; _flags |= Simulation::DIRTY_LINEAR_VELOCITY;
} }
} }
}
}); });
} }
void EntityItem::setAngularVelocity(const glm::vec3& value) { void EntityItem::setAngularVelocity(const glm::vec3& value) {
glm::vec3 angularVelocity = getLocalAngularVelocity(); glm::vec3 angularVelocity = getLocalAngularVelocity();
if (angularVelocity != value) { if (angularVelocity != value) {
if (getShapeType() == SHAPE_TYPE_STATIC_MESH) {
setLocalAngularVelocity(Vectors::ZERO);
} else {
float speed = glm::length(value); float speed = glm::length(value);
if (!glm::isnan(speed)) { if (!glm::isnan(speed)) {
const float MIN_ANGULAR_SPEED = 0.0002f; const float MIN_ANGULAR_SPEED = 0.0002f;
@ -1988,7 +1975,6 @@ void EntityItem::setAngularVelocity(const glm::vec3& value) {
} }
} }
} }
}
void EntityItem::setAngularDamping(float value) { void EntityItem::setAngularDamping(float value) {
auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING); auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING);