mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 02:45:56 +02:00
Merge pull request #14932 from AndrewMeadows/allow-kinematic-mesh
Case 21227: don't enforce MOTION_TYPE_STATIC on mesh shapes
This commit is contained in:
commit
c0240d2431
2 changed files with 32 additions and 51 deletions
|
@ -1923,11 +1923,6 @@ void EntityItem::setRotation(glm::quat rotation) {
|
|||
void EntityItem::setVelocity(const glm::vec3& value) {
|
||||
glm::vec3 velocity = getLocalVelocity();
|
||||
if (velocity != value) {
|
||||
if (getShapeType() == SHAPE_TYPE_STATIC_MESH) {
|
||||
if (velocity != Vectors::ZERO) {
|
||||
setLocalVelocity(Vectors::ZERO);
|
||||
}
|
||||
} else {
|
||||
float speed = glm::length(value);
|
||||
if (!glm::isnan(speed)) {
|
||||
const float MIN_LINEAR_SPEED = 0.001f;
|
||||
|
@ -1944,7 +1939,6 @@ void EntityItem::setVelocity(const glm::vec3& value) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityItem::setDamping(float value) {
|
||||
auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING);
|
||||
|
@ -1959,9 +1953,6 @@ void EntityItem::setDamping(float value) {
|
|||
void EntityItem::setGravity(const glm::vec3& value) {
|
||||
withWriteLock([&] {
|
||||
if (_gravity != value) {
|
||||
if (getShapeType() == SHAPE_TYPE_STATIC_MESH) {
|
||||
_gravity = Vectors::ZERO;
|
||||
} else {
|
||||
float magnitude = glm::length(value);
|
||||
if (!glm::isnan(magnitude)) {
|
||||
const float MAX_ACCELERATION_OF_GRAVITY = 10.0f * 9.8f; // 10g
|
||||
|
@ -1973,16 +1964,12 @@ void EntityItem::setGravity(const glm::vec3& value) {
|
|||
_flags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void EntityItem::setAngularVelocity(const glm::vec3& value) {
|
||||
glm::vec3 angularVelocity = getLocalAngularVelocity();
|
||||
if (angularVelocity != value) {
|
||||
if (getShapeType() == SHAPE_TYPE_STATIC_MESH) {
|
||||
setLocalAngularVelocity(Vectors::ZERO);
|
||||
} else {
|
||||
float speed = glm::length(value);
|
||||
if (!glm::isnan(speed)) {
|
||||
const float MIN_ANGULAR_SPEED = 0.0002f;
|
||||
|
@ -1999,7 +1986,6 @@ void EntityItem::setAngularVelocity(const glm::vec3& value) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityItem::setAngularDamping(float value) {
|
||||
auto clampedDamping = glm::clamp(value, ENTITY_ITEM_MIN_DAMPING, ENTITY_ITEM_MAX_DAMPING);
|
||||
|
|
|
@ -203,11 +203,6 @@ PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
|
|||
}
|
||||
assert(entityTreeIsLocked());
|
||||
|
||||
if (_entity->getShapeType() == SHAPE_TYPE_STATIC_MESH
|
||||
|| (_body && _body->getCollisionShape()->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)) {
|
||||
return MOTION_TYPE_STATIC;
|
||||
}
|
||||
|
||||
if (_entity->getLocked()) {
|
||||
if (_entity->isMoving()) {
|
||||
return MOTION_TYPE_KINEMATIC;
|
||||
|
|
Loading…
Reference in a new issue