Updated property in MyAvatar.h

This commit is contained in:
RebeccaStankus 2019-08-30 13:41:46 -07:00
parent a33bc3722d
commit 5fadfa5275
6 changed files with 2 additions and 21 deletions

View file

@ -154,6 +154,7 @@ class MyAvatar : public Avatar {
* *
* @property {Vec3} qmlPosition - A synonym for <code>position</code> for use by QML. * @property {Vec3} qmlPosition - A synonym for <code>position</code> for use by QML.
* *
* @property {Vec3} feetPosition - The position of the avatar's feet.
* @property {boolean} shouldRenderLocally=true - If <code>true</code> then your avatar is rendered for you in Interface, * @property {boolean} shouldRenderLocally=true - If <code>true</code> then your avatar is rendered for you in Interface,
* otherwise it is not rendered for you (but it is still rendered for other users). * otherwise it is not rendered for you (but it is still rendered for other users).
* @property {Vec3} motorVelocity=Vec3.ZERO - The target velocity of your avatar to be achieved by a scripted motor. * @property {Vec3} motorVelocity=Vec3.ZERO - The target velocity of your avatar to be achieved by a scripted motor.
@ -340,6 +341,7 @@ class MyAvatar : public Avatar {
Q_PROPERTY(QVector3D qmlPosition READ getQmlPosition) Q_PROPERTY(QVector3D qmlPosition READ getQmlPosition)
QVector3D getQmlPosition() { auto p = getWorldPosition(); return QVector3D(p.x, p.y, p.z); } QVector3D getQmlPosition() { auto p = getWorldPosition(); return QVector3D(p.x, p.y, p.z); }
Q_PROPERTY(glm::vec3 feetPosition READ getWorldFeetPosition WRITE goToFeetLocation)
Q_PROPERTY(bool shouldRenderLocally READ getShouldRenderLocally WRITE setShouldRenderLocally) Q_PROPERTY(bool shouldRenderLocally READ getShouldRenderLocally WRITE setShouldRenderLocally)
Q_PROPERTY(glm::vec3 motorVelocity READ getScriptedMotorVelocity WRITE setScriptedMotorVelocity) Q_PROPERTY(glm::vec3 motorVelocity READ getScriptedMotorVelocity WRITE setScriptedMotorVelocity)
Q_PROPERTY(float motorTimescale READ getScriptedMotorTimescale WRITE setScriptedMotorTimescale) Q_PROPERTY(float motorTimescale READ getScriptedMotorTimescale WRITE setScriptedMotorTimescale)

View file

@ -1848,13 +1848,6 @@ void Avatar::setPositionViaScript(const glm::vec3& position) {
updateAttitude(getWorldOrientation()); updateAttitude(getWorldOrientation());
} }
void Avatar::setFeetPositionViaScript(const glm::vec3& position) {
auto feetAjustment = getWorldPosition() - getWorldFeetPosition();
auto _goToPosition = position + feetAjustment;
setWorldPosition(_goToPosition);
updateAttitude(getWorldOrientation());
}
void Avatar::setOrientationViaScript(const glm::quat& orientation) { void Avatar::setOrientationViaScript(const glm::quat& orientation) {
setWorldOrientation(orientation); setWorldOrientation(orientation);
updateAttitude(orientation); updateAttitude(orientation);

View file

@ -437,7 +437,6 @@ public:
Q_INVOKABLE glm::vec3 getWorldFeetPosition(); Q_INVOKABLE glm::vec3 getWorldFeetPosition();
void setPositionViaScript(const glm::vec3& position) override; void setPositionViaScript(const glm::vec3& position) override;
void setFeetPositionViaScript(const glm::vec3& position) override;
void setOrientationViaScript(const glm::quat& orientation) override; void setOrientationViaScript(const glm::quat& orientation) override;
/**jsdoc /**jsdoc

View file

@ -488,7 +488,6 @@ class AvatarData : public QObject, public SpatiallyNestable {
// IMPORTANT: The JSDoc for the following properties should be copied to MyAvatar.h and ScriptableAvatar.h. // IMPORTANT: The JSDoc for the following properties should be copied to MyAvatar.h and ScriptableAvatar.h.
/* /*
* @property {Vec3} position - The position of the avatar. * @property {Vec3} position - The position of the avatar.
* @property {Vec3} feetPosition - The feet position of the avatar.
* @property {number} scale=1.0 - The scale of the avatar. The value can be set to anything between <code>0.005</code> and * @property {number} scale=1.0 - The scale of the avatar. The value can be set to anything between <code>0.005</code> and
* <code>1000.0</code>. When the scale value is fetched, it may temporarily be further limited by the domain's settings. * <code>1000.0</code>. When the scale value is fetched, it may temporarily be further limited by the domain's settings.
* @property {number} density - The density of the avatar in kg/m<sup>3</sup>. The density is used to work out its mass in * @property {number} density - The density of the avatar in kg/m<sup>3</sup>. The density is used to work out its mass in
@ -537,7 +536,6 @@ class AvatarData : public QObject, public SpatiallyNestable {
* <em>Read-only.</em> * <em>Read-only.</em>
*/ */
Q_PROPERTY(glm::vec3 position READ getWorldPosition WRITE setPositionViaScript) Q_PROPERTY(glm::vec3 position READ getWorldPosition WRITE setPositionViaScript)
Q_PROPERTY(glm::vec3 feetPosition READ getWorldFeetPosition WRITE setFeetPositionViaScript)
Q_PROPERTY(float scale READ getDomainLimitedScale WRITE setTargetScale) Q_PROPERTY(float scale READ getDomainLimitedScale WRITE setTargetScale)
Q_PROPERTY(float density READ getDensity) Q_PROPERTY(float density READ getDensity)
Q_PROPERTY(glm::vec3 handPosition READ getHandPosition WRITE setHandPosition) Q_PROPERTY(glm::vec3 handPosition READ getHandPosition WRITE setHandPosition)
@ -631,7 +629,6 @@ public:
void setBodyRoll(float bodyRoll); void setBodyRoll(float bodyRoll);
virtual void setPositionViaScript(const glm::vec3& position); virtual void setPositionViaScript(const glm::vec3& position);
virtual void setFeetPositionViaScript(const glm::vec3& position);
virtual void setOrientationViaScript(const glm::quat& orientation); virtual void setOrientationViaScript(const glm::quat& orientation);
virtual void updateAttitude(const glm::quat& orientation) {} virtual void updateAttitude(const glm::quat& orientation) {}

View file

@ -31,13 +31,6 @@ glm::vec3 ScriptAvatarData::getPosition() const {
return glm::vec3(); return glm::vec3();
} }
} }
glm::vec3 ScriptAvatarData::getFeetPosition() const {
if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) {
return sharedAvatarData->getWorldFeetPosition();
} else {
return glm::vec3();
}
}
float ScriptAvatarData::getTargetScale() const { float ScriptAvatarData::getTargetScale() const {
if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) { if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) {
return sharedAvatarData->getTargetScale(); return sharedAvatarData->getTargetScale();

View file

@ -20,7 +20,6 @@
* Information about an avatar. * Information about an avatar.
* @typedef {object} AvatarData * @typedef {object} AvatarData
* @property {Vec3} position - The avatar's position. * @property {Vec3} position - The avatar's position.
* @property {Vec3} feetPosition - The avatar's feet position.
* @property {number} scale - The target scale of the avatar without any restrictions on permissible values imposed by the * @property {number} scale - The target scale of the avatar without any restrictions on permissible values imposed by the
* domain. * domain.
* @property {Vec3} handPosition - A user-defined hand position, in world coordinates. The position moves with the avatar but * @property {Vec3} handPosition - A user-defined hand position, in world coordinates. The position moves with the avatar but
@ -71,7 +70,6 @@ class ScriptAvatarData : public QObject {
// PHYSICAL PROPERTIES: POSITION AND ORIENTATION // PHYSICAL PROPERTIES: POSITION AND ORIENTATION
// //
Q_PROPERTY(glm::vec3 position READ getPosition) Q_PROPERTY(glm::vec3 position READ getPosition)
Q_PROPERTY(glm::vec3 feetPosition READ getFeetPosition)
Q_PROPERTY(float scale READ getTargetScale) Q_PROPERTY(float scale READ getTargetScale)
Q_PROPERTY(glm::vec3 handPosition READ getHandPosition) Q_PROPERTY(glm::vec3 handPosition READ getHandPosition)
Q_PROPERTY(float bodyPitch READ getBodyPitch) Q_PROPERTY(float bodyPitch READ getBodyPitch)
@ -126,7 +124,6 @@ public:
// PHYSICAL PROPERTIES: POSITION AND ORIENTATION // PHYSICAL PROPERTIES: POSITION AND ORIENTATION
// //
glm::vec3 getPosition() const; glm::vec3 getPosition() const;
glm::vec3 getFeetPosition() const;
float getTargetScale() const; float getTargetScale() const;
glm::vec3 getHandPosition() const; glm::vec3 getHandPosition() const;
float getBodyPitch() const; float getBodyPitch() const;