mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 20:58:38 +02:00
Merge pull request #4690 from AndrewMeadows/bispinor
use fallback avatar movement logic when skeleton model still downloading
This commit is contained in:
commit
cd159b7ae2
2 changed files with 10 additions and 9 deletions
|
@ -41,8 +41,8 @@ protected:
|
||||||
|
|
||||||
DynamicCharacterController::DynamicCharacterController(AvatarData* avatarData) {
|
DynamicCharacterController::DynamicCharacterController(AvatarData* avatarData) {
|
||||||
_halfHeight = 1.0f;
|
_halfHeight = 1.0f;
|
||||||
_shape = NULL;
|
_shape = nullptr;
|
||||||
_rigidBody = NULL;
|
_rigidBody = nullptr;
|
||||||
|
|
||||||
assert(avatarData);
|
assert(avatarData);
|
||||||
_avatarData = avatarData;
|
_avatarData = avatarData;
|
||||||
|
@ -262,7 +262,7 @@ void DynamicCharacterController::setDynamicsWorld(btDynamicsWorld* world) {
|
||||||
_dynamicsWorld->removeRigidBody(_rigidBody);
|
_dynamicsWorld->removeRigidBody(_rigidBody);
|
||||||
_dynamicsWorld->removeAction(this);
|
_dynamicsWorld->removeAction(this);
|
||||||
}
|
}
|
||||||
_dynamicsWorld = NULL;
|
_dynamicsWorld = nullptr;
|
||||||
}
|
}
|
||||||
if (world && _rigidBody) {
|
if (world && _rigidBody) {
|
||||||
_dynamicsWorld = world;
|
_dynamicsWorld = world;
|
||||||
|
@ -292,9 +292,9 @@ void DynamicCharacterController::updateShapeIfNecessary() {
|
||||||
_pendingFlags &= ~ PENDING_FLAG_UPDATE_SHAPE;
|
_pendingFlags &= ~ PENDING_FLAG_UPDATE_SHAPE;
|
||||||
// delete shape and RigidBody
|
// delete shape and RigidBody
|
||||||
delete _rigidBody;
|
delete _rigidBody;
|
||||||
_rigidBody = NULL;
|
_rigidBody = nullptr;
|
||||||
delete _shape;
|
delete _shape;
|
||||||
_shape = NULL;
|
_shape = nullptr;
|
||||||
|
|
||||||
// compute new dimensions from avatar's bounding box
|
// compute new dimensions from avatar's bounding box
|
||||||
float x = _boxScale.x;
|
float x = _boxScale.x;
|
||||||
|
@ -314,7 +314,7 @@ void DynamicCharacterController::updateShapeIfNecessary() {
|
||||||
// create new body
|
// create new body
|
||||||
float mass = 1.0f;
|
float mass = 1.0f;
|
||||||
btVector3 inertia(1.0f, 1.0f, 1.0f);
|
btVector3 inertia(1.0f, 1.0f, 1.0f);
|
||||||
_rigidBody = new btRigidBody(mass, NULL, _shape, inertia);
|
_rigidBody = new btRigidBody(mass, nullptr, _shape, inertia);
|
||||||
_rigidBody->setSleepingThresholds(0.0f, 0.0f);
|
_rigidBody->setSleepingThresholds(0.0f, 0.0f);
|
||||||
_rigidBody->setAngularFactor(0.0f);
|
_rigidBody->setAngularFactor(0.0f);
|
||||||
_rigidBody->setWorldTransform(btTransform(glmToBullet(_avatarData->getOrientation()),
|
_rigidBody->setWorldTransform(btTransform(glmToBullet(_avatarData->getOrientation()),
|
||||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
||||||
|
|
||||||
glm::vec3 _shapeLocalOffset;
|
glm::vec3 _shapeLocalOffset;
|
||||||
glm::vec3 _boxScale; // used to compute capsule shape
|
glm::vec3 _boxScale; // used to compute capsule shape
|
||||||
AvatarData* _avatarData = NULL;
|
AvatarData* _avatarData = nullptr;
|
||||||
|
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
bool _isOnGround;
|
bool _isOnGround;
|
||||||
|
@ -41,7 +41,7 @@ protected:
|
||||||
quint64 _jumpToHoverStart;
|
quint64 _jumpToHoverStart;
|
||||||
uint32_t _pendingFlags;
|
uint32_t _pendingFlags;
|
||||||
|
|
||||||
btDynamicsWorld* _dynamicsWorld = NULL;
|
btDynamicsWorld* _dynamicsWorld = nullptr;
|
||||||
|
|
||||||
btScalar _jumpSpeed;
|
btScalar _jumpSpeed;
|
||||||
|
|
||||||
|
@ -78,7 +78,8 @@ public:
|
||||||
bool needsRemoval() const;
|
bool needsRemoval() const;
|
||||||
bool needsAddition() const;
|
bool needsAddition() const;
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
bool isEnabled() const { return _enabled; }
|
bool isEnabled() const { return _enabled && _dynamicsWorld; }
|
||||||
|
|
||||||
void setDynamicsWorld(btDynamicsWorld* world);
|
void setDynamicsWorld(btDynamicsWorld* world);
|
||||||
|
|
||||||
void setLocalBoundingBox(const glm::vec3& corner, const glm::vec3& scale);
|
void setLocalBoundingBox(const glm::vec3& corner, const glm::vec3& scale);
|
||||||
|
|
Loading…
Reference in a new issue