overte-HifiExperiments/libraries/animation/src/RotationConstraint.h
Anthony J. Thibault 837b19ed1b fix for pushing avatar into floor when exiting away mode.
* Removed MyAvatar.reset() access from JavaScript
* Added HMD.centerUI() to JavaScript, which can be used to reset the 3D UI sphere around the current HMD orientation.
* Added MyAvatar.clearIKJOintLimitHistory() which can be used to reset any remembered IK joint limit history.
* Added MyAvatar.centerBody() which can be used to instantly re-orient the avatar's so that the hips and toes
  are facing the same direction as the current HMD orientation.

away.js now uses the above new API's instead of MyAvatar.reset()
2016-07-19 14:42:24 -07:00

45 lines
1.4 KiB
C++

//
// RotationConstraint.h
//
// Copyright 2015 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_RotationConstraint_h
#define hifi_RotationConstraint_h
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
class RotationConstraint {
public:
RotationConstraint() : _referenceRotation() {}
virtual ~RotationConstraint() {}
/// \param referenceRotation the rotation from which rotation changes are measured.
virtual void setReferenceRotation(const glm::quat& rotation) { _referenceRotation = rotation; }
/// \return the rotation from which rotation changes are measured.
const glm::quat& getReferenceRotation() const { return _referenceRotation; }
/// \param rotation rotation to clamp
/// \return true if rotation is clamped
virtual bool apply(glm::quat& rotation) const = 0;
/// \return true if this constraint is part of lower spine
virtual bool isLowerSpine() const { return false; }
/// \param rotation rotation to allow
/// \brief clear previous adjustment and adjust constraint limits to allow rotation
virtual void dynamicallyAdjustLimits(const glm::quat& rotation) {}
/// \brief reset any remembered joint limit history
virtual void clearHistory() {};
protected:
glm::quat _referenceRotation = glm::quat();
};
#endif // hifi_RotationConstraint_h