mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +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->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->setLastSimulated(usecTimestampNow());
|
||||
|
|
|
@ -80,9 +80,7 @@ void ObjectMotionState::setBodyGravity(const glm::vec3& gravity) const {
|
|||
}
|
||||
|
||||
glm::vec3 ObjectMotionState::getBodyLinearVelocity() const {
|
||||
// returns the body's velocity
|
||||
btVector3 velocity = _body->getLinearVelocity();
|
||||
return bulletToGLM(velocity);
|
||||
return bulletToGLM(_body->getLinearVelocity());
|
||||
}
|
||||
|
||||
glm::vec3 ObjectMotionState::getObjectLinearVelocityChange() const {
|
||||
|
|
Loading…
Reference in a new issue