mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 14:46:55 +02:00
Other avatars after update and mod timer when active
This commit is contained in:
parent
942e9ccdfd
commit
954cac907d
5 changed files with 26 additions and 26 deletions
|
@ -271,14 +271,6 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
|||
if (avatar->getSkeletonModel()->isLoaded()) {
|
||||
// remove the orb if it is there
|
||||
avatar->removeOrb();
|
||||
if (avatar->getWorkloadRegion() == workload::Region::R1) {
|
||||
auto &flow = _myAvatar->getSkeletonModel()->getRig().getFlow();
|
||||
for (auto &handJointName : HAND_COLLISION_JOINTS) {
|
||||
int jointIndex = avatar->getJointIndex(handJointName);
|
||||
glm::vec3 position = avatar->getJointPosition(jointIndex);
|
||||
flow.setOthersCollision(avatar->getID(), jointIndex, position);
|
||||
}
|
||||
}
|
||||
if (avatar->needsPhysicsUpdate()) {
|
||||
_avatarsToChangeInPhysics.insert(avatar);
|
||||
}
|
||||
|
@ -305,6 +297,9 @@ void AvatarManager::updateOtherAvatars(float deltaTime) {
|
|||
avatar->setIsNewAvatar(false);
|
||||
}
|
||||
avatar->simulate(deltaTime, inView);
|
||||
if (avatar->getSkeletonModel()->isLoaded() && avatar->getWorkloadRegion() == workload::Region::R1) {
|
||||
_myAvatar->addAvatarHandsToFlow(avatar);
|
||||
}
|
||||
avatar->updateRenderItem(renderTransaction);
|
||||
avatar->updateSpaceProxy(workloadTransaction);
|
||||
avatar->setLastRenderUpdateTime(startTime);
|
||||
|
|
|
@ -5312,3 +5312,11 @@ void MyAvatar::releaseGrab(const QUuid& grabID) {
|
|||
}
|
||||
}
|
||||
|
||||
void MyAvatar::addAvatarHandsToFlow(const std::shared_ptr<Avatar>& otherAvatar) {
|
||||
auto &flow = _skeletonModel->getRig().getFlow();
|
||||
for (auto &handJointName : HAND_COLLISION_JOINTS) {
|
||||
int jointIndex = otherAvatar->getJointIndex(handJointName);
|
||||
glm::vec3 position = otherAvatar->getJointPosition(jointIndex);
|
||||
flow.setOthersCollision(otherAvatar->getID(), jointIndex, position);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1182,6 +1182,8 @@ public:
|
|||
void updateAvatarEntity(const QUuid& entityID, const QByteArray& entityData) override;
|
||||
void avatarEntityDataToJson(QJsonObject& root) const override;
|
||||
int sendAvatarDataPacket(bool sendAll = false) override;
|
||||
|
||||
void addAvatarHandsToFlow(const std::shared_ptr<Avatar>& otherAvatar);
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
|
@ -461,7 +461,6 @@ void Flow::calculateConstraints() {
|
|||
auto simPrefix = SIM_JOINT_PREFIX.toUpper();
|
||||
auto skeleton = _rig->getAnimSkeleton();
|
||||
std::vector<int> handsIndices;
|
||||
_collisionSystem.resetCollisions();
|
||||
if (skeleton) {
|
||||
for (int i = 0; i < skeleton->getNumJoints(); i++) {
|
||||
auto name = skeleton->getJointName(i);
|
||||
|
@ -517,10 +516,6 @@ void Flow::calculateConstraints() {
|
|||
_collisionSystem.addCollisionSphere(i, PRESET_COLLISION_DATA.at(name));
|
||||
}
|
||||
}
|
||||
if (isFlowJoint || isSimJoint) {
|
||||
auto jointInfo = FlowJointInfo(i, parentIndex, -1, name);
|
||||
_flowJointInfos.push_back(jointInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,7 +599,9 @@ void Flow::cleanUp() {
|
|||
_flowJointData.clear();
|
||||
_jointThreads.clear();
|
||||
_flowJointKeywords.clear();
|
||||
_flowJointInfos.clear();
|
||||
_collisionSystem.resetCollisions();
|
||||
_initialized = false;
|
||||
_active = false;
|
||||
}
|
||||
|
||||
void Flow::setTransform(float scale, const glm::vec3& position, const glm::quat& rotation) {
|
||||
|
@ -619,9 +616,9 @@ void Flow::setTransform(float scale, const glm::vec3& position, const glm::quat&
|
|||
}
|
||||
|
||||
void Flow::update() {
|
||||
QElapsedTimer _timer;
|
||||
_timer.start();
|
||||
if (_initialized && _active) {
|
||||
QElapsedTimer _timer;
|
||||
_timer.start();
|
||||
updateJoints();
|
||||
int count = 0;
|
||||
for (auto &thread : _jointThreads) {
|
||||
|
@ -633,15 +630,14 @@ void Flow::update() {
|
|||
thread.apply();
|
||||
}
|
||||
setJoints();
|
||||
}
|
||||
_deltaTime += _timer.nsecsElapsed();
|
||||
_updates++;
|
||||
if (_deltaTime > _deltaTimeLimit) {
|
||||
qDebug() << "Flow C++ update " << _deltaTime / _updates << " nanoSeconds";
|
||||
_deltaTime = 0;
|
||||
_updates = 0;
|
||||
}
|
||||
|
||||
_deltaTime += _timer.nsecsElapsed();
|
||||
_updates++;
|
||||
if (_deltaTime > _deltaTimeLimit) {
|
||||
qDebug() << "Flow C++ update " << _deltaTime / _updates << " nanoSeconds";
|
||||
_deltaTime = 0;
|
||||
_updates = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Flow::worldToJointPoint(const glm::vec3& position, const int jointIndex, glm::vec3& jointSpacePosition) const {
|
||||
|
|
|
@ -296,7 +296,6 @@ private:
|
|||
std::map<int, FlowJoint> _flowJointData;
|
||||
std::vector<FlowThread> _jointThreads;
|
||||
std::vector<QString> _flowJointKeywords;
|
||||
std::vector<FlowJointInfo> _flowJointInfos;
|
||||
FlowCollisionSystem _collisionSystem;
|
||||
bool _initialized { false };
|
||||
bool _active { false };
|
||||
|
|
Loading…
Reference in a new issue