mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
exposing palm velocity and angular velocity to js
This commit is contained in:
parent
d415ee1f2e
commit
113c4ea28b
4 changed files with 61 additions and 6 deletions
|
@ -410,6 +410,22 @@ glm::vec3 MyAvatar::getLeftPalmPosition() {
|
||||||
return leftHandPosition;
|
return leftHandPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 MyAvatar::getLeftPalmVelocity() {
|
||||||
|
const PalmData* palm = getHand()->getPalm(LEFT_HAND_INDEX);
|
||||||
|
if (palm != NULL) {
|
||||||
|
return palm->getVelocity();
|
||||||
|
}
|
||||||
|
return glm::vec3(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec3 MyAvatar::getLeftPalmAngularVelocity() {
|
||||||
|
const PalmData* palm = getHand()->getPalm(LEFT_HAND_INDEX);
|
||||||
|
if (palm != NULL) {
|
||||||
|
return palm->getRawAngularVelocity();
|
||||||
|
}
|
||||||
|
return glm::vec3(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
glm::quat MyAvatar::getLeftPalmRotation() {
|
glm::quat MyAvatar::getLeftPalmRotation() {
|
||||||
glm::quat leftRotation;
|
glm::quat leftRotation;
|
||||||
getSkeletonModel().getJointRotationInWorldFrame(getSkeletonModel().getLeftHandJointIndex(), leftRotation);
|
getSkeletonModel().getJointRotationInWorldFrame(getSkeletonModel().getLeftHandJointIndex(), leftRotation);
|
||||||
|
@ -425,6 +441,22 @@ glm::vec3 MyAvatar::getRightPalmPosition() {
|
||||||
return rightHandPosition;
|
return rightHandPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 MyAvatar::getRightPalmVelocity() {
|
||||||
|
const PalmData* palm = getHand()->getPalm(RIGHT_HAND_INDEX);
|
||||||
|
if (palm != NULL) {
|
||||||
|
return palm->getVelocity();
|
||||||
|
}
|
||||||
|
return glm::vec3(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec3 MyAvatar::getRightPalmAngularVelocity() {
|
||||||
|
const PalmData* palm = getHand()->getPalm(RIGHT_HAND_INDEX);
|
||||||
|
if (palm != NULL) {
|
||||||
|
return palm->getRawAngularVelocity();
|
||||||
|
}
|
||||||
|
return glm::vec3(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
glm::quat MyAvatar::getRightPalmRotation() {
|
glm::quat MyAvatar::getRightPalmRotation() {
|
||||||
glm::quat rightRotation;
|
glm::quat rightRotation;
|
||||||
getSkeletonModel().getJointRotationInWorldFrame(getSkeletonModel().getRightHandJointIndex(), rightRotation);
|
getSkeletonModel().getJointRotationInWorldFrame(getSkeletonModel().getRightHandJointIndex(), rightRotation);
|
||||||
|
|
|
@ -213,8 +213,12 @@ public slots:
|
||||||
void updateStandingHMDModeFromMenu();
|
void updateStandingHMDModeFromMenu();
|
||||||
|
|
||||||
glm::vec3 getLeftPalmPosition();
|
glm::vec3 getLeftPalmPosition();
|
||||||
|
glm::vec3 getLeftPalmVelocity();
|
||||||
|
glm::vec3 getLeftPalmAngularVelocity();
|
||||||
glm::quat getLeftPalmRotation();
|
glm::quat getLeftPalmRotation();
|
||||||
glm::vec3 getRightPalmPosition();
|
glm::vec3 getRightPalmPosition();
|
||||||
|
glm::vec3 getRightPalmVelocity();
|
||||||
|
glm::vec3 getRightPalmAngularVelocity();
|
||||||
glm::quat getRightPalmRotation();
|
glm::quat getRightPalmRotation();
|
||||||
|
|
||||||
void clearReferential();
|
void clearReferential();
|
||||||
|
|
|
@ -472,6 +472,18 @@ float ControllerScriptingInterface::getActionValue(int action) {
|
||||||
return DependencyManager::get<UserInputMapper>()->getActionState(UserInputMapper::Action(action));
|
return DependencyManager::get<UserInputMapper>()->getActionState(UserInputMapper::Action(action));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ControllerScriptingInterface::findAction(QString actionName) {
|
||||||
|
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
||||||
|
auto actions = getAllActions();
|
||||||
|
for (auto action : actions) {
|
||||||
|
if (userInputMapper->getActionName(action) == actionName) {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If the action isn't found, return -1
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) :
|
InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) :
|
||||||
AbstractInputController(),
|
AbstractInputController(),
|
||||||
_deviceTrackerId(deviceTrackerId),
|
_deviceTrackerId(deviceTrackerId),
|
||||||
|
|
|
@ -86,17 +86,24 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Q_INVOKABLE virtual QVector<UserInputMapper::Action> getAllActions();
|
Q_INVOKABLE virtual QVector<UserInputMapper::Action> getAllActions();
|
||||||
Q_INVOKABLE virtual QVector<UserInputMapper::InputChannel> getInputChannelsForAction(UserInputMapper::Action action);
|
|
||||||
Q_INVOKABLE virtual QString getDeviceName(unsigned int device);
|
|
||||||
Q_INVOKABLE virtual QVector<UserInputMapper::InputChannel> getAllInputsForDevice(unsigned int device);
|
|
||||||
Q_INVOKABLE virtual bool addInputChannel(UserInputMapper::InputChannel inputChannel);
|
Q_INVOKABLE virtual bool addInputChannel(UserInputMapper::InputChannel inputChannel);
|
||||||
Q_INVOKABLE virtual bool removeInputChannel(UserInputMapper::InputChannel inputChannel);
|
Q_INVOKABLE virtual bool removeInputChannel(UserInputMapper::InputChannel inputChannel);
|
||||||
|
Q_INVOKABLE virtual QVector<UserInputMapper::InputChannel> getInputChannelsForAction(UserInputMapper::Action action);
|
||||||
|
|
||||||
Q_INVOKABLE virtual QVector<UserInputMapper::InputPair> getAvailableInputs(unsigned int device);
|
Q_INVOKABLE virtual QVector<UserInputMapper::InputPair> getAvailableInputs(unsigned int device);
|
||||||
Q_INVOKABLE virtual void resetAllDeviceBindings();
|
Q_INVOKABLE virtual QVector<UserInputMapper::InputChannel> getAllInputsForDevice(unsigned int device);
|
||||||
Q_INVOKABLE virtual void resetDevice(unsigned int device);
|
|
||||||
Q_INVOKABLE virtual int findDevice(QString name);
|
Q_INVOKABLE virtual QString getDeviceName(unsigned int device);
|
||||||
|
|
||||||
Q_INVOKABLE virtual float getActionValue(int action);
|
Q_INVOKABLE virtual float getActionValue(int action);
|
||||||
|
|
||||||
|
Q_INVOKABLE virtual void resetDevice(unsigned int device);
|
||||||
|
Q_INVOKABLE virtual void resetAllDeviceBindings();
|
||||||
|
Q_INVOKABLE virtual int findDevice(QString name);
|
||||||
|
|
||||||
|
Q_INVOKABLE virtual int findAction(QString actionName);
|
||||||
|
|
||||||
virtual bool isPrimaryButtonPressed() const;
|
virtual bool isPrimaryButtonPressed() const;
|
||||||
virtual glm::vec2 getPrimaryJoystickPosition() const;
|
virtual glm::vec2 getPrimaryJoystickPosition() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue