mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
make getCollisionCapsule thread safe
This commit is contained in:
parent
b517808bc2
commit
ceccc6d6ec
3 changed files with 18 additions and 4 deletions
|
@ -149,7 +149,8 @@ MyAvatar::MyAvatar(QThread* thread) :
|
|||
});
|
||||
connect(_skeletonModel.get(), &Model::rigReady, this, &Avatar::rigReady);
|
||||
connect(_skeletonModel.get(), &Model::rigReset, this, &Avatar::rigReset);
|
||||
|
||||
connect(&_skeletonModel->getRig(), &Rig::onLoadComplete, this, &MyAvatar::updateCollisionCapsule);
|
||||
connect(this, &MyAvatar::sensorToWorldScaleChanged, this, &MyAvatar::updateCollisionCapsule);
|
||||
using namespace recording;
|
||||
_skeletonModel->flagAsCauterized();
|
||||
|
||||
|
@ -255,6 +256,7 @@ MyAvatar::MyAvatar(QThread* thread) :
|
|||
});
|
||||
|
||||
connect(&(_skeletonModel->getRig()), SIGNAL(onLoadComplete()), this, SIGNAL(onLoadComplete()));
|
||||
|
||||
_characterController.setDensity(_density);
|
||||
}
|
||||
|
||||
|
@ -3307,7 +3309,7 @@ bool MyAvatar::getCollisionsEnabled() {
|
|||
return _characterController.computeCollisionGroup() != BULLET_COLLISION_GROUP_COLLISIONLESS;
|
||||
}
|
||||
|
||||
QVariantMap MyAvatar::getCollisionCapsule() {
|
||||
void MyAvatar::updateCollisionCapsule() {
|
||||
glm::vec3 start, end;
|
||||
float radius;
|
||||
getCapsule(start, end, radius);
|
||||
|
@ -3315,7 +3317,12 @@ QVariantMap MyAvatar::getCollisionCapsule() {
|
|||
capsule["start"] = vec3toVariant(start);
|
||||
capsule["end"] = vec3toVariant(end);
|
||||
capsule["radius"] = QVariant(radius);
|
||||
return capsule;
|
||||
_capsuleShape.set(capsule);
|
||||
}
|
||||
|
||||
// thread safe
|
||||
QVariantMap MyAvatar::getCollisionCapsule() const {
|
||||
return _capsuleShape.get();
|
||||
}
|
||||
|
||||
void MyAvatar::setCharacterControllerEnabled(bool enabled) {
|
||||
|
|
|
@ -1021,7 +1021,7 @@ public:
|
|||
* @function MyAvatar.getCollisionCapsule
|
||||
* @returns {object}
|
||||
*/
|
||||
Q_INVOKABLE QVariantMap getCollisionCapsule();
|
||||
Q_INVOKABLE QVariantMap getCollisionCapsule() const;
|
||||
|
||||
/**jsdoc
|
||||
* @function MyAvatar.setCharacterControllerEnabled
|
||||
|
@ -1373,6 +1373,11 @@ public slots:
|
|||
*/
|
||||
virtual void setModelScale(float scale) override;
|
||||
|
||||
/**jsdoc
|
||||
* @function MyAvatar.updateCollisionCapsule
|
||||
*/
|
||||
void updateCollisionCapsule();
|
||||
|
||||
signals:
|
||||
|
||||
/**jsdoc
|
||||
|
|
|
@ -1444,6 +1444,8 @@ protected:
|
|||
ThreadSafeValueCache<glm::mat4> _farGrabLeftMatrixCache { glm::mat4() };
|
||||
ThreadSafeValueCache<glm::mat4> _farGrabMouseMatrixCache { glm::mat4() };
|
||||
|
||||
ThreadSafeValueCache<QVariantMap> _capsuleShape { QVariantMap() };
|
||||
|
||||
int getFauxJointIndex(const QString& name) const;
|
||||
|
||||
float _audioLoudness { 0.0f };
|
||||
|
|
Loading…
Reference in a new issue