mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 12:54:38 +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) {
|
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;
|
||||||
|
@ -1943,7 +1938,6 @@ void EntityItem::setVelocity(const glm::vec3& value) {
|
||||||
_flags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
_flags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::setDamping(float value) {
|
void EntityItem::setDamping(float value) {
|
||||||
|
@ -1959,9 +1953,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
|
||||||
|
@ -1973,16 +1964,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;
|
||||||
|
@ -1998,7 +1985,6 @@ void EntityItem::setAngularVelocity(const glm::vec3& value) {
|
||||||
_flags |= Simulation::DIRTY_ANGULAR_VELOCITY;
|
_flags |= Simulation::DIRTY_ANGULAR_VELOCITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::setAngularDamping(float value) {
|
void EntityItem::setAngularDamping(float value) {
|
||||||
|
|
|
@ -203,11 +203,6 @@ PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
|
||||||
}
|
}
|
||||||
assert(entityTreeIsLocked());
|
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->getLocked()) {
|
||||||
if (_entity->isMoving()) {
|
if (_entity->isMoving()) {
|
||||||
return MOTION_TYPE_KINEMATIC;
|
return MOTION_TYPE_KINEMATIC;
|
||||||
|
|
Loading…
Reference in a new issue