Merge branch 'black-bis' of github.com:samcake/hifi into black-bis

This commit is contained in:
sam gateau 2018-09-07 15:35:27 -07:00
commit e8cfac2ab1
19 changed files with 254 additions and 74 deletions

View file

@ -780,6 +780,12 @@ Rectangle {
headerVisible: true;
sortIndicatorColumn: settings.connectionsSortIndicatorColumn;
sortIndicatorOrder: settings.connectionsSortIndicatorOrder;
onSortIndicatorColumnChanged: {
settings.connectionsSortIndicatorColumn = sortIndicatorColumn;
}
onSortIndicatorOrderChanged: {
settings.connectionsSortIndicatorOrder = sortIndicatorOrder;
}
TableViewColumn {
id: connectionsUserNameHeader;

View file

@ -516,6 +516,10 @@ void MyAvatar::update(float deltaTime) {
head->relax(deltaTime);
updateFromTrackers(deltaTime);
if (getIsInWalkingState() && glm::length(getControllerPoseInAvatarFrame(controller::Action::HEAD).getVelocity()) < DEFAULT_AVATAR_WALK_SPEED_THRESHOLD) {
setIsInWalkingState(false);
}
// Get audio loudness data from audio input device
// Also get the AudioClient so we can update the avatar bounding box data
// on the AudioClient side.
@ -3678,10 +3682,10 @@ static bool headAngularVelocityBelowThreshold(const controller::Pose& head) {
return isBelowThreshold;
}
static bool isWithinThresholdHeightMode(const controller::Pose& head,const float& newMode) {
static bool isWithinThresholdHeightMode(const controller::Pose& head, const float& newMode, const float& scale) {
bool isWithinThreshold = true;
if (head.isValid()) {
isWithinThreshold = (head.getTranslation().y - newMode) > DEFAULT_AVATAR_MODE_HEIGHT_STEPPING_THRESHOLD;
isWithinThreshold = (head.getTranslation().y - newMode) > (DEFAULT_AVATAR_MODE_HEIGHT_STEPPING_THRESHOLD * scale);
}
return isWithinThreshold;
}
@ -3802,6 +3806,10 @@ float MyAvatar::getUserEyeHeight() const {
return userHeight - userHeight * ratio;
}
bool MyAvatar::getIsInWalkingState() const {
return _isInWalkingState;
}
float MyAvatar::getWalkSpeed() const {
return _walkSpeed.get() * _walkSpeedScalar;
}
@ -3818,6 +3826,10 @@ void MyAvatar::setSprintMode(bool sprint) {
_walkSpeedScalar = sprint ? _sprintSpeed.get() : AVATAR_WALK_SPEED_SCALAR;
}
void MyAvatar::setIsInWalkingState(bool isWalking) {
_isInWalkingState = isWalking;
}
void MyAvatar::setWalkSpeed(float value) {
_walkSpeed.set(value);
}
@ -3912,7 +3924,6 @@ void MyAvatar::lateUpdatePalms() {
Avatar::updatePalms();
}
static const float FOLLOW_TIME = 0.5f;
MyAvatar::FollowHelper::FollowHelper() {
@ -4004,24 +4015,36 @@ bool MyAvatar::FollowHelper::shouldActivateHorizontalCG(MyAvatar& myAvatar) cons
controller::Pose currentRightHandPose = myAvatar.getControllerPoseInAvatarFrame(controller::Action::RIGHT_HAND);
bool stepDetected = false;
if (!withinBaseOfSupport(currentHeadPose) &&
float myScale = myAvatar.getAvatarScale();
if (myAvatar.getIsInWalkingState()) {
stepDetected = true;
} else {
if (!withinBaseOfSupport(currentHeadPose) &&
headAngularVelocityBelowThreshold(currentHeadPose) &&
isWithinThresholdHeightMode(currentHeadPose, myAvatar.getCurrentStandingHeight()) &&
isWithinThresholdHeightMode(currentHeadPose, myAvatar.getCurrentStandingHeight(), myScale) &&
handDirectionMatchesHeadDirection(currentLeftHandPose, currentRightHandPose, currentHeadPose) &&
handAngularVelocityBelowThreshold(currentLeftHandPose, currentRightHandPose) &&
headVelocityGreaterThanThreshold(currentHeadPose) &&
isHeadLevel(currentHeadPose, myAvatar.getAverageHeadRotation())) {
// a step is detected
stepDetected = true;
} else {
glm::vec3 defaultHipsPosition = myAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(myAvatar.getJointIndex("Hips"));
glm::vec3 defaultHeadPosition = myAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(myAvatar.getJointIndex("Head"));
glm::vec3 currentHeadPosition = currentHeadPose.getTranslation();
float anatomicalHeadToHipsDistance = glm::length(defaultHeadPosition - defaultHipsPosition);
if (!isActive(Horizontal) &&
(glm::length(currentHeadPosition - defaultHipsPosition) > (anatomicalHeadToHipsDistance + (DEFAULT_AVATAR_SPINE_STRETCH_LIMIT * anatomicalHeadToHipsDistance)))) {
myAvatar.setResetMode(true);
// a step is detected
stepDetected = true;
if (glm::length(currentHeadPose.velocity) > DEFAULT_AVATAR_WALK_SPEED_THRESHOLD) {
myAvatar.setIsInWalkingState(true);
}
} else {
glm::vec3 defaultHipsPosition = myAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(myAvatar.getJointIndex("Hips"));
glm::vec3 defaultHeadPosition = myAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(myAvatar.getJointIndex("Head"));
glm::vec3 currentHeadPosition = currentHeadPose.getTranslation();
float anatomicalHeadToHipsDistance = glm::length(defaultHeadPosition - defaultHipsPosition);
if (!isActive(Horizontal) &&
(glm::length(currentHeadPosition - defaultHipsPosition) > (anatomicalHeadToHipsDistance + (DEFAULT_AVATAR_SPINE_STRETCH_LIMIT * anatomicalHeadToHipsDistance)))) {
myAvatar.setResetMode(true);
stepDetected = true;
if (glm::length(currentHeadPose.velocity) > DEFAULT_AVATAR_WALK_SPEED_THRESHOLD) {
myAvatar.setIsInWalkingState(true);
}
}
}
}
return stepDetected;

View file

@ -1086,6 +1086,8 @@ public:
const QUuid& getSelfID() const { return AVATAR_SELF_ID; }
void setIsInWalkingState(bool isWalking);
bool getIsInWalkingState() const;
void setWalkSpeed(float value);
float getWalkSpeed() const;
void setWalkBackwardSpeed(float value);
@ -1788,6 +1790,7 @@ private:
ThreadSafeValueCache<float> _walkBackwardSpeed { DEFAULT_AVATAR_MAX_WALKING_BACKWARD_SPEED };
ThreadSafeValueCache<float> _sprintSpeed { AVATAR_SPRINT_SPEED_SCALAR };
float _walkSpeedScalar { AVATAR_WALK_SPEED_SCALAR };
bool _isInWalkingState { false };
// load avatar scripts once when rig is ready
bool _shouldLoadScripts { false };

View file

@ -16,8 +16,9 @@ Transform MyAvatarHeadTransformNode::getTransform() {
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
glm::vec3 pos = myAvatar->getHeadPosition();
glm::vec3 scale = glm::vec3(myAvatar->scaleForChildren());
glm::quat headOri = myAvatar->getHeadOrientation();
glm::quat ori = headOri * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT);
return Transform(ori, glm::vec3(1.0f), pos);
return Transform(ori, scale, pos);
}

View file

@ -46,7 +46,7 @@ static AnimPose computeHipsInSensorFrame(MyAvatar* myAvatar, bool isFlying) {
}
glm::mat4 hipsMat;
if (myAvatar->getCenterOfGravityModelEnabled() && !isFlying) {
if (myAvatar->getCenterOfGravityModelEnabled() && !isFlying && !(myAvatar->getIsInWalkingState())) {
// then we use center of gravity model
hipsMat = myAvatar->deriveBodyUsingCgModel();
} else {

View file

@ -86,23 +86,23 @@ bool CollisionPick::isLoaded() const {
return !_mathPick.shouldComputeShapeInfo() || (_cachedResource && _cachedResource->isLoaded());
}
bool CollisionPick::getShapeInfoReady() {
bool CollisionPick::getShapeInfoReady(const CollisionRegion& pick) {
if (_mathPick.shouldComputeShapeInfo()) {
if (_cachedResource && _cachedResource->isLoaded()) {
computeShapeInfo(_mathPick, *_mathPick.shapeInfo, _cachedResource);
computeShapeInfo(pick, *_mathPick.shapeInfo, _cachedResource);
_mathPick.loaded = true;
} else {
_mathPick.loaded = false;
}
} else {
computeShapeInfoDimensionsOnly(_mathPick, *_mathPick.shapeInfo, _cachedResource);
computeShapeInfoDimensionsOnly(pick, *_mathPick.shapeInfo, _cachedResource);
_mathPick.loaded = true;
}
return _mathPick.loaded;
}
void CollisionPick::computeShapeInfoDimensionsOnly(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource) {
void CollisionPick::computeShapeInfoDimensionsOnly(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource) {
ShapeType type = shapeInfo.getType();
glm::vec3 dimensions = pick.transform.getScale();
QString modelURL = (resource ? resource->getURL().toString() : "");
@ -115,7 +115,7 @@ void CollisionPick::computeShapeInfoDimensionsOnly(CollisionRegion& pick, ShapeI
}
}
void CollisionPick::computeShapeInfo(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource) {
void CollisionPick::computeShapeInfo(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource) {
// This code was copied and modified from RenderableModelEntityItem::computeShapeInfo
// TODO: Move to some shared code area (in entities-renderer? model-networking?)
// after we verify this is working and do a diff comparison with RenderableModelEntityItem::computeShapeInfo
@ -357,12 +357,14 @@ CollisionPick::CollisionPick(const PickFilter& filter, float maxDistance, bool e
CollisionRegion CollisionPick::getMathematicalPick() const {
CollisionRegion mathPick = _mathPick;
mathPick.loaded = isLoaded();
if (!parentTransform) {
return mathPick;
} else {
mathPick.transform = parentTransform->getTransform().worldTransform(mathPick.transform);
return mathPick;
if (parentTransform) {
Transform parentTransformValue = parentTransform->getTransform();
mathPick.transform = parentTransformValue.worldTransform(mathPick.transform);
glm::vec3 scale = parentTransformValue.getScale();
float largestDimension = glm::max(glm::max(scale.x, scale.y), scale.z);
mathPick.threshold *= largestDimension;
}
return mathPick;
}
void CollisionPick::filterIntersections(std::vector<ContactTestResult>& intersections) const {
@ -393,9 +395,9 @@ PickResultPointer CollisionPick::getEntityIntersection(const CollisionRegion& pi
// Cannot compute result
return std::make_shared<CollisionPickResult>(pick.toVariantMap(), std::vector<ContactTestResult>(), std::vector<ContactTestResult>());
}
getShapeInfoReady();
getShapeInfoReady(pick);
auto entityIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_ENTITIES, *pick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold);
auto entityIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_ENTITIES, *_mathPick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold);
filterIntersections(entityIntersections);
return std::make_shared<CollisionPickResult>(pick, entityIntersections, std::vector<ContactTestResult>());
}
@ -409,9 +411,9 @@ PickResultPointer CollisionPick::getAvatarIntersection(const CollisionRegion& pi
// Cannot compute result
return std::make_shared<CollisionPickResult>(pick, std::vector<ContactTestResult>(), std::vector<ContactTestResult>());
}
getShapeInfoReady();
getShapeInfoReady(pick);
auto avatarIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_AVATARS, *pick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold);
auto avatarIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_AVATARS, *_mathPick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold);
filterIntersections(avatarIntersections);
return std::make_shared<CollisionPickResult>(pick, std::vector<ContactTestResult>(), avatarIntersections);
}

View file

@ -62,9 +62,9 @@ protected:
// Returns true if the resource for _mathPick.shapeInfo is loaded or if a resource is not needed.
bool isLoaded() const;
// Returns true if _mathPick.shapeInfo is valid. Otherwise, attempts to get the _mathPick ready for use.
bool getShapeInfoReady();
void computeShapeInfo(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource);
void computeShapeInfoDimensionsOnly(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource);
bool getShapeInfoReady(const CollisionRegion& pick);
void computeShapeInfo(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource);
void computeShapeInfoDimensionsOnly(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer<GeometryResource> resource);
void filterIntersections(std::vector<ContactTestResult>& intersections) const;
CollisionRegion _mathPick;

View file

@ -24,11 +24,14 @@
#include "CollisionPick.h"
#include "SpatialParentFinder.h"
#include "NestableTransformNode.h"
#include "PickTransformNode.h"
#include "MouseTransformNode.h"
#include "avatar/MyAvatarHeadTransformNode.h"
#include "avatar/AvatarManager.h"
#include "NestableTransformNode.h"
#include "avatars-renderer/AvatarTransformNode.h"
#include "ui/overlays/OverlayTransformNode.h"
#include "EntityTransformNode.h"
#include <ScriptEngine.h>
@ -260,9 +263,16 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti
* A set of properties that can be passed to {@link Picks.createPick} to create a new Collision Pick.
* @typedef {object} Picks.CollisionPickProperties
* @property {Shape} shape - The information about the collision region's size and shape.
* @property {Vec3} position - The position of the collision region.
* @property {Quat} orientation - The orientation of the collision region.
* @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results.
* @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR.
* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are in world space, but will scale with the parent if defined.
* @property {Vec3} position - The position of the collision region, relative to a parent if defined.
* @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined.
* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region.
* The depth is measured in world space, but will scale with the parent if defined.
* @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay.
* @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint)
* @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar.
*/
unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) {
QVariantMap propMap = properties.toMap();
@ -375,7 +385,16 @@ std::shared_ptr<TransformNode> PickScriptingInterface::createTransformNode(const
}
auto sharedNestablePointer = nestablePointer.lock();
if (success && sharedNestablePointer) {
return std::make_shared<NestableTransformNode>(nestablePointer, parentJointIndex);
NestableType nestableType = sharedNestablePointer->getNestableType();
if (nestableType == NestableType::Avatar) {
return std::make_shared<AvatarTransformNode>(std::static_pointer_cast<Avatar>(sharedNestablePointer), parentJointIndex);
} else if (nestableType == NestableType::Overlay) {
return std::make_shared<OverlayTransformNode>(std::static_pointer_cast<Base3DOverlay>(sharedNestablePointer), parentJointIndex);
} else if (nestableType == NestableType::Entity) {
return std::make_shared<EntityTransformNode>(std::static_pointer_cast<EntityItem>(sharedNestablePointer), parentJointIndex);
} else {
return std::make_shared<NestableTransformNode>(nestablePointer, parentJointIndex);
}
}
}
@ -394,7 +413,7 @@ std::shared_ptr<TransformNode> PickScriptingInterface::createTransformNode(const
} else if (!joint.isNull()) {
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
int jointIndex = myAvatar->getJointIndex(joint);
return std::make_shared<NestableTransformNode>(myAvatar, jointIndex);
return std::make_shared<AvatarTransformNode>(myAvatar, jointIndex);
}
}

View file

@ -0,0 +1,13 @@
//
// Created by Sabrina Shanman 9/5/2018
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "OverlayTransformNode.h"
template<>
glm::vec3 BaseNestableTransformNode<Base3DOverlay>::getActualScale(const std::shared_ptr<Base3DOverlay>& nestablePointer) const {
return nestablePointer->getBounds().getScale();
}

View file

@ -0,0 +1,21 @@
//
// Created by Sabrina Shanman 9/5/2018
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_OverlayTransformNode_h
#define hifi_OverlayTransformNode_h
#include "NestableTransformNode.h"
#include "Base3DOverlay.h"
// For 3D overlays only
class OverlayTransformNode : public BaseNestableTransformNode<Base3DOverlay> {
public:
OverlayTransformNode(std::weak_ptr<Base3DOverlay> spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {};
};
#endif // hifi_OverlayTransformNode_h

View file

@ -0,0 +1,13 @@
//
// Created by Sabrina Shanman 9/5/2018
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "AvatarTransformNode.h"
template<>
glm::vec3 BaseNestableTransformNode<Avatar>::getActualScale(const std::shared_ptr<Avatar>& nestablePointer) const {
return nestablePointer->scaleForChildren();
}

View file

@ -0,0 +1,20 @@
//
// Created by Sabrina Shanman 9/5/2018
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_AvatarTransformNode_h
#define hifi_AvatarTransformNode_h
#include "NestableTransformNode.h"
#include "Avatar.h"
class AvatarTransformNode : public BaseNestableTransformNode<Avatar> {
public:
AvatarTransformNode(std::weak_ptr<Avatar> spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {};
};
#endif // hifi_AvatarTransformNode_h

View file

@ -0,0 +1,13 @@
//
// Created by Sabrina Shanman 9/5/2018
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "EntityTransformNode.h"
template<>
glm::vec3 BaseNestableTransformNode<EntityItem>::getActualScale(const std::shared_ptr<EntityItem>& nestablePointer) const {
return nestablePointer->getScaledDimensions();
}

View file

@ -0,0 +1,20 @@
//
// Created by Sabrina Shanman 9/5/2018
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_EntityTransformNode_h
#define hifi_EntityTransformNode_h
#include "NestableTransformNode.h"
#include "EntityItem.h"
class EntityTransformNode : public BaseNestableTransformNode<EntityItem> {
public:
EntityTransformNode(std::weak_ptr<EntityItem> spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {};
};
#endif // hifi_EntityTransformNode_h

View file

@ -68,6 +68,7 @@ const glm::quat DEFAULT_AVATAR_RIGHTFOOT_ROT { -0.4016716778278351f, 0.915461599
const float DEFAULT_AVATAR_MAX_WALKING_SPEED = 2.6f; // meters / second
const float DEFAULT_AVATAR_MAX_WALKING_BACKWARD_SPEED = 2.2f; // meters / second
const float DEFAULT_AVATAR_MAX_FLYING_SPEED = 30.0f; // meters / second
const float DEFAULT_AVATAR_WALK_SPEED_THRESHOLD = 0.15f;
const float DEFAULT_AVATAR_GRAVITY = -5.0f; // meters / second^2
const float DEFAULT_AVATAR_JUMP_SPEED = 3.5f; // meters / second

View file

@ -8,24 +8,7 @@
#include "NestableTransformNode.h"
NestableTransformNode::NestableTransformNode(SpatiallyNestableWeakPointer spatiallyNestable, int jointIndex) :
_spatiallyNestable(spatiallyNestable),
_jointIndex(jointIndex)
{
}
Transform NestableTransformNode::getTransform() {
auto nestable = _spatiallyNestable.lock();
if (!nestable) {
return Transform();
}
bool success;
Transform jointWorldTransform = nestable->getTransform(_jointIndex, success);
if (success) {
return jointWorldTransform;
} else {
return Transform();
}
template<>
glm::vec3 BaseNestableTransformNode<SpatiallyNestable>::getActualScale(const std::shared_ptr<SpatiallyNestable>& nestablePointer) const {
return nestablePointer->getAbsoluteJointScaleInObjectFrame(_jointIndex);
}

View file

@ -12,14 +12,48 @@
#include "SpatiallyNestable.h"
class NestableTransformNode : public TransformNode {
template <typename T>
class BaseNestableTransformNode : public TransformNode {
public:
NestableTransformNode(SpatiallyNestableWeakPointer spatiallyNestable, int jointIndex);
Transform getTransform() override;
BaseNestableTransformNode(std::weak_ptr<T> spatiallyNestable, int jointIndex) :
_spatiallyNestable(spatiallyNestable),
_jointIndex(jointIndex) {
auto nestablePointer = _spatiallyNestable.lock();
if (nestablePointer) {
glm::vec3 nestableDimensions = getActualScale(nestablePointer);
_baseScale = glm::max(glm::vec3(0.001f), nestableDimensions);
}
}
Transform getTransform() override {
std::shared_ptr<T> nestable = _spatiallyNestable.lock();
if (!nestable) {
return Transform();
}
bool success;
Transform jointWorldTransform = nestable->getTransform(_jointIndex, success);
if (!success) {
return Transform();
}
jointWorldTransform.setScale(getActualScale(nestable) / _baseScale);
return jointWorldTransform;
}
glm::vec3 getActualScale(const std::shared_ptr<T>& nestablePointer) const;
protected:
SpatiallyNestableWeakPointer _spatiallyNestable;
std::weak_ptr<T> _spatiallyNestable;
int _jointIndex;
glm::vec3 _baseScale { 1.0f };
};
class NestableTransformNode : public BaseNestableTransformNode<SpatiallyNestable> {
public:
NestableTransformNode(std::weak_ptr<SpatiallyNestable> spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {};
};
#endif // hifi_NestableTransformNode_h

View file

@ -259,10 +259,11 @@ public:
* A CollisionRegion defines a volume for checking collisions in the physics simulation.
* @typedef {object} CollisionRegion
* @property {Shape} shape - The information about the collision region's size and shape.
* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are in world space, but will scale with the parent if defined.
* @property {Vec3} position - The position of the collision region, relative to a parent if defined.
* @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined.
* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region.
* The depth is measured in world space, but will scale with the parent if defined.
* @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay.
* @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint)
* @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar.

View file

@ -23,7 +23,7 @@ if (scripts.length >= 2) {
var qml = Script.resolvePath('debugWindow.qml');
var HMD_DEBUG_WINDOW_GEOMETRY_KEY = 'hmdDebugWindowGeometry';
var hmdDebugWindowGeometryValue = Settings.getValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY)
var hmdDebugWindowGeometryValue = Settings.getValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY);
var windowWidth = 400;
var windowHeight = 900;
@ -34,12 +34,13 @@ var windowY = 0;
if (hmdDebugWindowGeometryValue !== '') {
var geometry = JSON.parse(hmdDebugWindowGeometryValue);
windowWidth = geometry.width
windowHeight = geometry.height
windowX = geometry.x
windowY = geometry.y
hasPosition = true;
if ((geometry.x !== 0) && (geometry.y !== 0)) {
windowWidth = geometry.width;
windowHeight = geometry.height;
windowX = geometry.x;
windowY = geometry.y;
hasPosition = true;
}
}
var window = new OverlayWindow({
@ -52,6 +53,12 @@ if (hasPosition) {
window.setPosition(windowX, windowY);
}
window.visibleChanged.connect(function() {
if (!window.visible) {
window.setVisible(true);
}
});
window.closed.connect(function () { Script.stop(); });
var getFormattedDate = function() {
@ -93,10 +100,10 @@ Script.scriptEnding.connect(function () {
y: window.position.y,
width: window.size.x,
height: window.size.y
})
});
Settings.setValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY, geometry);
window.close();
})
});
}());