mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:28:37 +02:00
remove velocity restrictions on SHAPE_TYPE_STATIC_MESH
This commit is contained in:
parent
304f993391
commit
2fdc9bce77
1 changed files with 32 additions and 46 deletions
|
@ -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;
|
||||||
|
@ -1932,7 +1927,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) {
|
||||||
|
@ -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;
|
||||||
|
@ -1987,7 +1974,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) {
|
||||||
|
|
Loading…
Reference in a new issue