mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-04 03:01:11 +02:00
adding option to disable teleportring
This commit is contained in:
parent
bb9a764855
commit
deaf3e8e44
5 changed files with 21 additions and 13 deletions
|
@ -16,10 +16,11 @@ import controlsUit 1.0
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
height: spacer.height + Math.max(hifi.dimensions.controlLineHeight, checkBox.implicitHeight)
|
height: spacer.height + Math.max(hifi.dimensions.controlLineHeight, checkBox.implicitHeight)
|
||||||
|
property bool value: false
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
checkBox.checked = preference.value;
|
checkBox.checked = preference.value;
|
||||||
preference.value = Qt.binding(function(){ return checkBox.checked; });
|
preference.value = Qt.binding(function(){ return checkBox.checked; });
|
||||||
|
value = checkBox.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
@ -47,6 +48,7 @@ Preference {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Tablet.playSound(TabletEnums.ButtonClick);
|
Tablet.playSound(TabletEnums.ButtonClick);
|
||||||
|
value = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
@ -123,12 +123,12 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runtime customization of preferences.
|
// Runtime customization of preferences.
|
||||||
var locomotionPreference = findPreference("VR Movement", "Teleporting only / Walking and teleporting");
|
var locomotionPreference = findPreference("VR Movement", "Walking");
|
||||||
var flyingPreference = findPreference("VR Movement", "Jumping and flying");
|
var flyingPreference = findPreference("VR Movement", "Jumping and flying");
|
||||||
if (locomotionPreference && flyingPreference) {
|
if (locomotionPreference && flyingPreference) {
|
||||||
flyingPreference.visible = (locomotionPreference.value === 1);
|
flyingPreference.visible = locomotionPreference.value;
|
||||||
locomotionPreference.valueChanged.connect(function () {
|
locomotionPreference.valueChanged.connect(function () {
|
||||||
flyingPreference.visible = (locomotionPreference.value === 1);
|
flyingPreference.visible = locomotionPreference.value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (HMD.isHeadControllerAvailable("Oculus")) {
|
if (HMD.isHeadControllerAvailable("Oculus")) {
|
||||||
|
|
|
@ -247,6 +247,7 @@ class MyAvatar : public Avatar {
|
||||||
Q_PROPERTY(bool isInSittingState READ getIsInSittingState WRITE setIsInSittingState);
|
Q_PROPERTY(bool isInSittingState READ getIsInSittingState WRITE setIsInSittingState);
|
||||||
Q_PROPERTY(MyAvatar::SitStandModelType userRecenterModel READ getUserRecenterModel WRITE setUserRecenterModel);
|
Q_PROPERTY(MyAvatar::SitStandModelType userRecenterModel READ getUserRecenterModel WRITE setUserRecenterModel);
|
||||||
Q_PROPERTY(bool isSitStandStateLocked READ getIsSitStandStateLocked WRITE setIsSitStandStateLocked);
|
Q_PROPERTY(bool isSitStandStateLocked READ getIsSitStandStateLocked WRITE setIsSitStandStateLocked);
|
||||||
|
Q_PROPERTY(bool allowTeleporting READ getAllowTeleporting)
|
||||||
|
|
||||||
const QString DOMINANT_LEFT_HAND = "left";
|
const QString DOMINANT_LEFT_HAND = "left";
|
||||||
const QString DOMINANT_RIGHT_HAND = "right";
|
const QString DOMINANT_RIGHT_HAND = "right";
|
||||||
|
@ -559,6 +560,9 @@ public:
|
||||||
void setUseAdvancedMovementControls(bool useAdvancedMovementControls)
|
void setUseAdvancedMovementControls(bool useAdvancedMovementControls)
|
||||||
{ _useAdvancedMovementControls.set(useAdvancedMovementControls); }
|
{ _useAdvancedMovementControls.set(useAdvancedMovementControls); }
|
||||||
|
|
||||||
|
bool getAllowTeleporting() { return _allowTeleportingSetting.get(); }
|
||||||
|
void setAllowTeleporting(bool allowTeleporting) { _allowTeleportingSetting.set(allowTeleporting); }
|
||||||
|
|
||||||
bool getShowPlayArea() const { return _showPlayArea.get(); }
|
bool getShowPlayArea() const { return _showPlayArea.get(); }
|
||||||
void setShowPlayArea(bool showPlayArea) { _showPlayArea.set(showPlayArea); }
|
void setShowPlayArea(bool showPlayArea) { _showPlayArea.set(showPlayArea); }
|
||||||
|
|
||||||
|
@ -1889,6 +1893,7 @@ private:
|
||||||
Setting::Handle<float> _userHeightSetting;
|
Setting::Handle<float> _userHeightSetting;
|
||||||
Setting::Handle<bool> _flyingHMDSetting;
|
Setting::Handle<bool> _flyingHMDSetting;
|
||||||
Setting::Handle<int> _avatarEntityCountSetting;
|
Setting::Handle<int> _avatarEntityCountSetting;
|
||||||
|
Setting::Handle<bool> _allowTeleportingSetting { "allowTeleporting", true };
|
||||||
std::vector<Setting::Handle<QUuid>> _avatarEntityIDSettings;
|
std::vector<Setting::Handle<QUuid>> _avatarEntityIDSettings;
|
||||||
std::vector<Setting::Handle<QByteArray>> _avatarEntityDataSettings;
|
std::vector<Setting::Handle<QByteArray>> _avatarEntityDataSettings;
|
||||||
};
|
};
|
||||||
|
|
|
@ -238,14 +238,15 @@ void setupPreferences() {
|
||||||
|
|
||||||
static const QString VR_MOVEMENT{ "VR Movement" };
|
static const QString VR_MOVEMENT{ "VR Movement" };
|
||||||
{
|
{
|
||||||
auto getter = [myAvatar]()->int { return myAvatar->useAdvancedMovementControls() ? 1 : 0; };
|
auto getter = [myAvatar]()->bool { return myAvatar->getAllowTeleporting(); };
|
||||||
auto setter = [myAvatar](int value) { myAvatar->setUseAdvancedMovementControls(value == 1); };
|
auto setter = [myAvatar](bool value) { myAvatar->setAllowTeleporting(value); };
|
||||||
auto preference =
|
auto preference = new CheckPreference(VR_MOVEMENT, "Teleporting", getter, setter);
|
||||||
new RadioButtonsPreference(VR_MOVEMENT, "Teleporting only / Walking and teleporting", getter, setter);
|
preferences->addPreference(preference);
|
||||||
QStringList items;
|
}
|
||||||
items << "Teleporting only" << "Walking and teleporting";
|
{
|
||||||
preference->setHeading("Movement mode");
|
auto getter = [myAvatar]()->bool { return myAvatar->useAdvancedMovementControls(); };
|
||||||
preference->setItems(items);
|
auto setter = [myAvatar](bool value) { myAvatar->setUseAdvancedMovementControls(value); };
|
||||||
|
auto preference = new CheckPreference(VR_MOVEMENT, "Walking", getter, setter);
|
||||||
preferences->addPreference(preference);
|
preferences->addPreference(preference);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -701,7 +701,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.isReady = function(controllerData, deltaTime) {
|
this.isReady = function(controllerData, deltaTime) {
|
||||||
if (Window.interstitialModeEnabled && !Window.isPhysicsEnabled()) {
|
if ((Window.interstitialModeEnabled && !Window.isPhysicsEnabled()) || !MyAvatar.allowTeleporting) {
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue