mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-10 20:47:22 +02:00
try another way of fixing held object snagging at slow velocity
This commit is contained in:
parent
fbe3cb9511
commit
26dcaeb056
2 changed files with 7 additions and 4 deletions
|
@ -194,7 +194,12 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||||
_entity->setPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset());
|
_entity->setPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset());
|
||||||
_entity->setRotation(bulletToGLM(worldTrans.getRotation()));
|
_entity->setRotation(bulletToGLM(worldTrans.getRotation()));
|
||||||
|
|
||||||
_entity->setVelocity(getBodyLinearVelocity());
|
glm::vec3 velocity = getBodyLinearVelocity();
|
||||||
|
if (glm::length2(velocity) < MIN_LINEAR_SPEED_SQUARED) {
|
||||||
|
velocity *= 0.0f;
|
||||||
|
}
|
||||||
|
_entity->setVelocity(velocity);
|
||||||
|
|
||||||
_entity->setAngularVelocity(getBodyAngularVelocity());
|
_entity->setAngularVelocity(getBodyAngularVelocity());
|
||||||
|
|
||||||
_entity->setLastSimulated(usecTimestampNow());
|
_entity->setLastSimulated(usecTimestampNow());
|
||||||
|
|
|
@ -80,9 +80,7 @@ void ObjectMotionState::setBodyGravity(const glm::vec3& gravity) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 ObjectMotionState::getBodyLinearVelocity() const {
|
glm::vec3 ObjectMotionState::getBodyLinearVelocity() const {
|
||||||
// returns the body's velocity
|
return bulletToGLM(_body->getLinearVelocity());
|
||||||
btVector3 velocity = _body->getLinearVelocity();
|
|
||||||
return bulletToGLM(velocity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 ObjectMotionState::getObjectLinearVelocityChange() const {
|
glm::vec3 ObjectMotionState::getObjectLinearVelocityChange() const {
|
||||||
|
|
Loading…
Reference in a new issue