mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge remote-tracking branch 'hifi/master'
This commit is contained in:
commit
883bb5aa68
6 changed files with 25 additions and 9 deletions
|
@ -64,7 +64,6 @@ function activateWarp() {
|
|||
|
||||
var TRIGGER_PULLBACK_DISTANCE = 0.04;
|
||||
var WATCH_AVATAR_DISTANCE = 1.5;
|
||||
var MAX_WARP_YAW = 40.0;
|
||||
var MAX_PULLBACK_YAW = 5.0;
|
||||
|
||||
var sound = new Sound("http://public.highfidelity.io/sounds/Footsteps/FootstepW2Right-12db.wav");
|
||||
|
@ -72,7 +71,7 @@ function playSound() {
|
|||
var options = new AudioInjectionOptions();
|
||||
var position = MyAvatar.position;
|
||||
options.position = position;
|
||||
options.volume = 0.5;
|
||||
options.volume = 1.0;
|
||||
Audio.playSound(sound, options);
|
||||
}
|
||||
|
||||
|
@ -89,7 +88,7 @@ function updateWarp() {
|
|||
var deltaPitch = MyAvatar.getHeadFinalPitch() - headStartFinalPitch;
|
||||
deltaYaw = MyAvatar.getHeadFinalYaw() - headStartYaw;
|
||||
|
||||
willMove = (!watchAvatar && (Math.abs(deltaYaw) < MAX_WARP_YAW) && (keyDownTime > WARP_START_TIME));
|
||||
willMove = (!watchAvatar && (keyDownTime > WARP_START_TIME));
|
||||
|
||||
if (willMove) {
|
||||
//var distance = Math.pow((deltaPitch - WARP_PITCH_DEAD_ZONE) * WARP_SENSITIVITY, 2.0);
|
||||
|
|
|
@ -3766,8 +3766,9 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser
|
|||
// AvatarManager has some custom types
|
||||
AvatarManager::registerMetaTypes(scriptEngine);
|
||||
|
||||
// hook our avatar object into this script engine
|
||||
// hook our avatar and avatar hash map object into this script engine
|
||||
scriptEngine->setAvatarData(_myAvatar, "MyAvatar"); // leave it as a MyAvatar class to expose thrust features
|
||||
scriptEngine->setAvatarHashMap(&_avatarManager, "AvatarList");
|
||||
|
||||
CameraScriptableObject* cameraScriptable = new CameraScriptableObject(&_myCamera, &_viewFrustum);
|
||||
scriptEngine->registerGlobalObject("Camera", cameraScriptable);
|
||||
|
|
|
@ -381,6 +381,8 @@ private:
|
|||
AvatarData& operator= (const AvatarData&);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(AvatarData*)
|
||||
|
||||
class JointData {
|
||||
public:
|
||||
bool valid;
|
||||
|
|
|
@ -21,6 +21,7 @@ AvatarHashMap::AvatarHashMap() :
|
|||
connect(NodeList::getInstance(), &NodeList::uuidChanged, this, &AvatarHashMap::sessionUUIDChanged);
|
||||
}
|
||||
|
||||
|
||||
AvatarHash::iterator AvatarHashMap::erase(const AvatarHash::iterator& iterator) {
|
||||
qDebug() << "Removing Avatar with UUID" << iterator.key() << "from AvatarHashMap.";
|
||||
return _avatarHash.erase(iterator);
|
||||
|
@ -53,7 +54,10 @@ void AvatarHashMap::processAvatarMixerDatagram(const QByteArray& datagram, const
|
|||
}
|
||||
|
||||
bool AvatarHashMap::containsAvatarWithDisplayName(const QString& displayName) {
|
||||
|
||||
return avatarWithDisplayName(displayName) == NULL ? false : true;
|
||||
}
|
||||
|
||||
AvatarData* AvatarHashMap::avatarWithDisplayName(const QString& displayName) {
|
||||
AvatarHash::iterator avatarIterator = _avatarHash.begin();
|
||||
while (avatarIterator != _avatarHash.end()) {
|
||||
AvatarSharedPointer sharedAvatar = avatarIterator.value();
|
||||
|
@ -62,7 +66,7 @@ bool AvatarHashMap::containsAvatarWithDisplayName(const QString& displayName) {
|
|||
// check if this avatar should still be around
|
||||
if (!shouldKillAvatar(sharedAvatar)) {
|
||||
// we have a match, return true
|
||||
return true;
|
||||
return sharedAvatar.data();
|
||||
} else {
|
||||
// we should remove this avatar, do that now
|
||||
erase(avatarIterator);
|
||||
|
@ -75,7 +79,7 @@ bool AvatarHashMap::containsAvatarWithDisplayName(const QString& displayName) {
|
|||
}
|
||||
|
||||
// return false, no match
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AvatarSharedPointer AvatarHashMap::newSharedAvatar() {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "AvatarData.h"
|
||||
|
||||
typedef QSharedPointer<AvatarData> AvatarSharedPointer;
|
||||
typedef QWeakPointer<AvatarData> AvatarWeakPointer;
|
||||
typedef QHash<QUuid, AvatarSharedPointer> AvatarHash;
|
||||
|
||||
class AvatarHashMap : public QObject {
|
||||
|
@ -34,6 +35,7 @@ public:
|
|||
public slots:
|
||||
void processAvatarMixerDatagram(const QByteArray& datagram, const QWeakPointer<Node>& mixerWeakPointer);
|
||||
bool containsAvatarWithDisplayName(const QString& displayName);
|
||||
AvatarData* avatarWithDisplayName(const QString& displayname);
|
||||
|
||||
private slots:
|
||||
void sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID);
|
||||
|
|
|
@ -63,7 +63,15 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){
|
|||
return QScriptValue();
|
||||
}
|
||||
|
||||
QScriptValue injectorToScriptValue(QScriptEngine *engine, AudioInjector* const &in) {
|
||||
QScriptValue avatarDataToScriptValue(QScriptEngine* engine, AvatarData* const &in) {
|
||||
return engine->newQObject(in);
|
||||
}
|
||||
|
||||
void avatarDataFromScriptValue(const QScriptValue &object, AvatarData* &out) {
|
||||
out = qobject_cast<AvatarData*>(object.toQObject());
|
||||
}
|
||||
|
||||
QScriptValue injectorToScriptValue(QScriptEngine* engine, AudioInjector* const &in) {
|
||||
return engine->newQObject(in);
|
||||
}
|
||||
|
||||
|
@ -272,7 +280,7 @@ void ScriptEngine::init() {
|
|||
|
||||
qScriptRegisterMetaType(this, injectorToScriptValue, injectorFromScriptValue);
|
||||
qScriptRegisterMetaType(this, inputControllerToScriptValue, inputControllerFromScriptValue);
|
||||
|
||||
qScriptRegisterMetaType(this, avatarDataToScriptValue, avatarDataFromScriptValue);
|
||||
qScriptRegisterMetaType(this, animationDetailsToScriptValue, animationDetailsFromScriptValue);
|
||||
|
||||
registerGlobalObject("Script", this);
|
||||
|
|
Loading…
Reference in a new issue