History

Merge branch 'master' of git://github.com/worklist/hifi into windows_build

Brad Hefta-Gaub committed 12 years ago

Commit 392ff942 parents b947d1e 0f2aa6c11 files · +95 −53Browse files

Showing the changes to interface/src/DataServerClient.cpp (1 of 11 files). Show all

Unified · Split

interface/src/DataServerClient.cpp+17−8
@@ -175,25 +175,34 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int · 174 unmodified lines
175 }175 }
176 }176 }
177 }177 }
178 } else if (keyList[i] == DataServerKey::Domain && keyList[i + 1] == DataServerKey::Position178 } else if (keyList[i] == DataServerKey::Domain && keyList[i + 1] == DataServerKey::Position &&
179 && valueList[i] != " " && valueList[i + 1] != " ") {179 keyList[i + 2] == DataServerKey::Orientation && valueList[i] != " " &&
180 valueList[i + 1] != " " && valueList[i + 2] != " ") {
180 181
181 QStringList coordinateItems = valueList[i + 1].split(',');182 QStringList coordinateItems = valueList[i + 1].split(',');
183 QStringList orientationItems = valueList[i + 2].split(',');
182 184
183 if (coordinateItems.size() == 3) {185 if (coordinateItems.size() == 3 && orientationItems.size() == 3) {
184 186
185 // send a node kill request, indicating to other clients that they should play the "disappeared" effect187 // send a node kill request, indicating to other clients that they should play the "disappeared" effect
186 NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1);188 NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1);
187 189
188 qDebug() << "Changing domain to" << valueList[i].toLocal8Bit().constData() <<190 qDebug() << "Changing domain to" << valueList[i].toLocal8Bit().constData() <<
189 "and position to" << valueList[i + 1].toLocal8Bit().constData() <<191 ", position to" << valueList[i + 1].toLocal8Bit().constData() <<
192 ", and orientation to" << valueList[i + 2].toLocal8Bit().constData() <<
190 "to go to" << userString << "\n";193 "to go to" << userString << "\n";
191 194
192 NodeList::getInstance()->setDomainHostname(valueList[i]);195 NodeList::getInstance()->setDomainHostname(valueList[i]);
193 196 // orient the user to face the target
194 glm::vec3 newPosition(coordinateItems[0].toFloat(),197 glm::quat newOrientation = glm::quat(glm::radians(glm::vec3(orientationItems[0].toFloat(),
195 coordinateItems[1].toFloat(),198 orientationItems[1].toFloat(), orientationItems[2].toFloat()))) *
196 coordinateItems[2].toFloat());199 glm::angleAxis(180.0f, 0.0f, 1.0f, 0.0f);
200 Application::getInstance()->getAvatar()->setOrientation(newOrientation);
201
202 // move the user a couple units away
203 const float DISTANCE_TO_USER = 2.0f;
204 glm::vec3 newPosition = glm::vec3(coordinateItems[0].toFloat(), coordinateItems[1].toFloat(),
205 coordinateItems[2].toFloat()) - newOrientation * IDENTITY_FRONT * DISTANCE_TO_USER;
197 Application::getInstance()->getAvatar()->setPosition(newPosition);206 Application::getInstance()->getAvatar()->setPosition(newPosition);
198 }207 }
199 208