mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 11:13:29 +02:00
migrate SpatiallyNestable::getOrientation to getWorldOrientation, remove redundant getRotation
This commit is contained in:
parent
a7a0f03ede
commit
f63db42c0e
48 changed files with 141 additions and 145 deletions
interface/src
libraries
avatars-renderer/src/avatars-renderer
avatars/src
entities-renderer/src
EntityTreeRenderer.cppRenderableLightEntityItem.cppRenderableModelEntityItem.cppRenderablePolyLineEntityItem.cppRenderablePolyVoxEntityItem.cppRenderableShapeEntityItem.cppRenderableZoneEntityItem.cpp
entities/src
EntityItem.cppEntityScriptingInterface.cppEntityTreeElement.cppPolyVoxEntityItem.cppTextEntityItem.cppWebEntityItem.cpp
physics/src
shared/src
|
@ -967,7 +967,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
|
||||
// use our MyAvatar position and quat for address manager path
|
||||
addressManager->setPositionGetter([this]{ return getMyAvatar()->getWorldPosition(); });
|
||||
addressManager->setOrientationGetter([this]{ return getMyAvatar()->getOrientation(); });
|
||||
addressManager->setOrientationGetter([this]{ return getMyAvatar()->getWorldOrientation(); });
|
||||
|
||||
connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
|
||||
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
|
||||
|
@ -2400,7 +2400,7 @@ void Application::updateCamera(RenderArgs& renderArgs) {
|
|||
auto hmdWorldMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
||||
_myCamera.setOrientation(glm::normalize(glmExtractRotation(hmdWorldMat)));
|
||||
_myCamera.setPosition(extractTranslation(hmdWorldMat) +
|
||||
myAvatar->getOrientation() * boomOffset);
|
||||
myAvatar->getWorldOrientation() * boomOffset);
|
||||
}
|
||||
else {
|
||||
_myCamera.setOrientation(myAvatar->getHead()->getOrientation());
|
||||
|
@ -2410,13 +2410,13 @@ void Application::updateCamera(RenderArgs& renderArgs) {
|
|||
}
|
||||
else {
|
||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||
+ myAvatar->getOrientation() * boomOffset);
|
||||
+ myAvatar->getWorldOrientation() * boomOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||
if (isHMDMode()) {
|
||||
auto mirrorBodyOrientation = myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f));
|
||||
auto mirrorBodyOrientation = myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f));
|
||||
|
||||
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
|
||||
// Mirror HMD yaw and roll
|
||||
|
@ -2439,11 +2439,11 @@ void Application::updateCamera(RenderArgs& renderArgs) {
|
|||
+ mirrorBodyOrientation * hmdOffset);
|
||||
}
|
||||
else {
|
||||
_myCamera.setOrientation(myAvatar->getOrientation()
|
||||
_myCamera.setOrientation(myAvatar->getWorldOrientation()
|
||||
* glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
|
||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||
+ glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0)
|
||||
+ (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
||||
+ (myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
||||
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
||||
}
|
||||
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
|
||||
|
@ -2453,12 +2453,12 @@ void Application::updateCamera(RenderArgs& renderArgs) {
|
|||
if (cameraEntity != nullptr) {
|
||||
if (isHMDMode()) {
|
||||
glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
|
||||
_myCamera.setOrientation(cameraEntity->getRotation() * hmdRotation);
|
||||
_myCamera.setOrientation(cameraEntity->getWorldOrientation() * hmdRotation);
|
||||
glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix());
|
||||
_myCamera.setPosition(cameraEntity->getWorldPosition() + (hmdRotation * hmdOffset));
|
||||
}
|
||||
else {
|
||||
_myCamera.setOrientation(cameraEntity->getRotation());
|
||||
_myCamera.setOrientation(cameraEntity->getWorldOrientation());
|
||||
_myCamera.setPosition(cameraEntity->getWorldPosition());
|
||||
}
|
||||
}
|
||||
|
@ -3870,7 +3870,7 @@ void Application::idle() {
|
|||
if (!_keyboardFocusedEntity.get().isInvalidID()) {
|
||||
auto entity = getEntities()->getTree()->findEntityByID(_keyboardFocusedEntity.get());
|
||||
if (entity && _keyboardFocusHighlight) {
|
||||
_keyboardFocusHighlight->setRotation(entity->getRotation());
|
||||
_keyboardFocusHighlight->setWorldOrientation(entity->getWorldOrientation());
|
||||
_keyboardFocusHighlight->setWorldPosition(entity->getWorldPosition());
|
||||
}
|
||||
} else {
|
||||
|
@ -3878,7 +3878,7 @@ void Application::idle() {
|
|||
auto overlay =
|
||||
std::dynamic_pointer_cast<Web3DOverlay>(getOverlays().getOverlay(_keyboardFocusedOverlay.get()));
|
||||
if (overlay && _keyboardFocusHighlight) {
|
||||
_keyboardFocusHighlight->setRotation(overlay->getRotation());
|
||||
_keyboardFocusHighlight->setWorldOrientation(overlay->getWorldOrientation());
|
||||
_keyboardFocusHighlight->setWorldPosition(overlay->getWorldPosition());
|
||||
}
|
||||
}
|
||||
|
@ -4293,7 +4293,7 @@ void Application::updateMyAvatarLookAtPosition() {
|
|||
// TODO -- this code is probably wrong, getHeadPose() returns something in sensor frame, not avatar
|
||||
glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose();
|
||||
glm::quat hmdRotation = glm::quat_cast(headPose);
|
||||
lookAtSpot = _myCamera.getPosition() + myAvatar->getOrientation() * (hmdRotation * lookAtPosition);
|
||||
lookAtSpot = _myCamera.getPosition() + myAvatar->getWorldOrientation() * (hmdRotation * lookAtPosition);
|
||||
} else {
|
||||
lookAtSpot = myAvatar->getHead()->getEyePosition()
|
||||
+ (myAvatar->getHead()->getFinalOrientationInWorldFrame() * lookAtPosition);
|
||||
|
@ -4519,7 +4519,7 @@ void Application::setKeyboardFocusHighlight(const glm::vec3& position, const glm
|
|||
}
|
||||
|
||||
// Position focus
|
||||
_keyboardFocusHighlight->setRotation(rotation);
|
||||
_keyboardFocusHighlight->setWorldOrientation(rotation);
|
||||
_keyboardFocusHighlight->setWorldPosition(position);
|
||||
_keyboardFocusHighlight->setDimensions(dimensions);
|
||||
_keyboardFocusHighlight->setVisible(true);
|
||||
|
@ -4557,7 +4557,7 @@ void Application::setKeyboardFocusEntity(const EntityItemID& entityItemID) {
|
|||
}
|
||||
_lastAcceptedKeyPress = usecTimestampNow();
|
||||
|
||||
setKeyboardFocusHighlight(entity->getWorldPosition(), entity->getRotation(),
|
||||
setKeyboardFocusHighlight(entity->getWorldPosition(), entity->getWorldOrientation(),
|
||||
entity->getDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
@ -4594,7 +4594,7 @@ void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) {
|
|||
if (overlay->getProperty("showKeyboardFocusHighlight").toBool()) {
|
||||
auto size = overlay->getSize() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR;
|
||||
const float OVERLAY_DEPTH = 0.0105f;
|
||||
setKeyboardFocusHighlight(overlay->getWorldPosition(), overlay->getRotation(), glm::vec3(size.x, size.y, OVERLAY_DEPTH));
|
||||
setKeyboardFocusHighlight(overlay->getWorldPosition(), overlay->getWorldOrientation(), glm::vec3(size.x, size.y, OVERLAY_DEPTH));
|
||||
} else if (_keyboardFocusHighlight) {
|
||||
_keyboardFocusHighlight->setVisible(false);
|
||||
}
|
||||
|
@ -4686,7 +4686,7 @@ void Application::update(float deltaTime) {
|
|||
|
||||
controller::InputCalibrationData calibrationData = {
|
||||
myAvatar->getSensorToWorldMatrix(),
|
||||
createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getWorldPosition()),
|
||||
createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition()),
|
||||
myAvatar->getHMDSensorMatrix(),
|
||||
myAvatar->getCenterEyeCalibrationMat(),
|
||||
myAvatar->getHeadCalibrationMat(),
|
||||
|
@ -4796,7 +4796,7 @@ void Application::update(float deltaTime) {
|
|||
};
|
||||
|
||||
// copy controller poses from userInputMapper to myAvatar.
|
||||
glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getWorldPosition());
|
||||
glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition());
|
||||
glm::mat4 worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix());
|
||||
glm::mat4 avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix;
|
||||
for (auto& action : avatarControllerActions) {
|
||||
|
@ -6437,9 +6437,9 @@ void Application::addAssetToWorldAddEntity(QString filePath, QString mapping) {
|
|||
properties.setShapeType(SHAPE_TYPE_SIMPLE_COMPOUND);
|
||||
properties.setCollisionless(true); // Temporarily set so that doesn't collide with avatar.
|
||||
properties.setVisible(false); // Temporarily set so that don't see at large unresized dimensions.
|
||||
glm::vec3 positionOffset = getMyAvatar()->getOrientation() * (getMyAvatar()->getSensorToWorldScale() * glm::vec3(0.0f, 0.0f, -2.0f));
|
||||
glm::vec3 positionOffset = getMyAvatar()->getWorldOrientation() * (getMyAvatar()->getSensorToWorldScale() * glm::vec3(0.0f, 0.0f, -2.0f));
|
||||
properties.setPosition(getMyAvatar()->getWorldPosition() + positionOffset);
|
||||
properties.setRotation(getMyAvatar()->getOrientation());
|
||||
properties.setRotation(getMyAvatar()->getWorldOrientation());
|
||||
properties.setGravity(glm::vec3(0.0f, 0.0f, 0.0f));
|
||||
auto entityID = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties);
|
||||
|
||||
|
|
|
@ -531,5 +531,5 @@ void AvatarActionHold::lateAvatarUpdate(const AnimPose& prePhysicsRoomPose, cons
|
|||
bool positionSuccess;
|
||||
ownerEntity->setWorldPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset(), positionSuccess, false);
|
||||
bool orientationSuccess;
|
||||
ownerEntity->setOrientation(bulletToGLM(worldTrans.getRotation()), orientationSuccess, false);
|
||||
ownerEntity->setWorldOrientation(bulletToGLM(worldTrans.getRotation()), orientationSuccess, false);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ glm::vec3 AvatarMotionState::getObjectPosition() const {
|
|||
|
||||
// virtual
|
||||
glm::quat AvatarMotionState::getObjectRotation() const {
|
||||
return _avatar->getOrientation();
|
||||
return _avatar->getWorldOrientation();
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
|
|
@ -197,7 +197,7 @@ MyAvatar::MyAvatar(QThread* thread) :
|
|||
}
|
||||
|
||||
setWorldPosition(dummyAvatar.getWorldPosition());
|
||||
setOrientation(dummyAvatar.getOrientation());
|
||||
setWorldOrientation(dummyAvatar.getWorldOrientation());
|
||||
|
||||
if (!dummyAvatar.getAttachmentData().isEmpty()) {
|
||||
setAttachmentData(dummyAvatar.getAttachmentData());
|
||||
|
@ -250,11 +250,11 @@ void MyAvatar::registerMetaTypes(ScriptEnginePointer engine) {
|
|||
}
|
||||
|
||||
void MyAvatar::setOrientationVar(const QVariant& newOrientationVar) {
|
||||
Avatar::setOrientation(quatFromVariant(newOrientationVar));
|
||||
Avatar::setWorldOrientation(quatFromVariant(newOrientationVar));
|
||||
}
|
||||
|
||||
QVariant MyAvatar::getOrientationVar() const {
|
||||
return quatToVariant(Avatar::getOrientation());
|
||||
return quatToVariant(Avatar::getWorldOrientation());
|
||||
}
|
||||
|
||||
glm::quat MyAvatar::getOrientationOutbound() const {
|
||||
|
@ -329,7 +329,7 @@ void MyAvatar::centerBody() {
|
|||
|
||||
// this will become our new position.
|
||||
setWorldPosition(worldBodyPos);
|
||||
setOrientation(worldBodyRot);
|
||||
setWorldOrientation(worldBodyRot);
|
||||
|
||||
// reset the body in sensor space
|
||||
_bodySensorMatrix = newBodySensorMatrix;
|
||||
|
@ -373,7 +373,7 @@ void MyAvatar::reset(bool andRecenter, bool andReload, bool andHead) {
|
|||
|
||||
// this will become our new position.
|
||||
setWorldPosition(worldBodyPos);
|
||||
setOrientation(worldBodyRot);
|
||||
setWorldOrientation(worldBodyRot);
|
||||
|
||||
// now sample the new hmd orientation AFTER sensor reset, which should be identity.
|
||||
glm::mat4 identity;
|
||||
|
@ -411,7 +411,7 @@ void MyAvatar::update(float deltaTime) {
|
|||
|
||||
if (_goToPending) {
|
||||
setWorldPosition(_goToPosition);
|
||||
setOrientation(_goToOrientation);
|
||||
setWorldOrientation(_goToOrientation);
|
||||
_headControllerFacingMovingAverage = _headControllerFacing; // reset moving average
|
||||
_goToPending = false;
|
||||
// updateFromHMDSensorMatrix (called from paintGL) expects that the sensorToWorldMatrix is updated for any position changes
|
||||
|
@ -666,7 +666,7 @@ void MyAvatar::updateSensorToWorldMatrix() {
|
|||
// update the sensor mat so that the body position will end up in the desired
|
||||
// position when driven from the head.
|
||||
float sensorToWorldScale = getEyeHeight() / getUserEyeHeight();
|
||||
glm::mat4 desiredMat = createMatFromScaleQuatAndPos(glm::vec3(sensorToWorldScale), getOrientation(), getWorldPosition());
|
||||
glm::mat4 desiredMat = createMatFromScaleQuatAndPos(glm::vec3(sensorToWorldScale), getWorldOrientation(), getWorldPosition());
|
||||
_sensorToWorldMatrix = desiredMat * glm::inverse(_bodySensorMatrix);
|
||||
|
||||
lateUpdatePalms();
|
||||
|
@ -784,7 +784,7 @@ controller::Pose MyAvatar::getRightHandTipPose() const {
|
|||
|
||||
glm::vec3 MyAvatar::worldToJointPoint(const glm::vec3& position, const int jointIndex) const {
|
||||
glm::vec3 jointPos = getWorldPosition();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getRotation();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getWorldOrientation();//default value if no or invalid joint specified
|
||||
if (jointIndex != -1) {
|
||||
if (_skeletonModel->getJointPositionInWorldFrame(jointIndex, jointPos)) {
|
||||
_skeletonModel->getJointRotationInWorldFrame(jointIndex, jointRot);
|
||||
|
@ -799,7 +799,7 @@ glm::vec3 MyAvatar::worldToJointPoint(const glm::vec3& position, const int joint
|
|||
}
|
||||
|
||||
glm::vec3 MyAvatar::worldToJointDirection(const glm::vec3& worldDir, const int jointIndex) const {
|
||||
glm::quat jointRot = getRotation();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getWorldOrientation();//default value if no or invalid joint specified
|
||||
if ((jointIndex != -1) && (!_skeletonModel->getJointRotationInWorldFrame(jointIndex, jointRot))) {
|
||||
qWarning() << "Invalid joint index specified: " << jointIndex;
|
||||
}
|
||||
|
@ -809,7 +809,7 @@ glm::vec3 MyAvatar::worldToJointDirection(const glm::vec3& worldDir, const int j
|
|||
}
|
||||
|
||||
glm::quat MyAvatar::worldToJointRotation(const glm::quat& worldRot, const int jointIndex) const {
|
||||
glm::quat jointRot = getRotation();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getWorldOrientation();//default value if no or invalid joint specified
|
||||
if ((jointIndex != -1) && (!_skeletonModel->getJointRotationInWorldFrame(jointIndex, jointRot))) {
|
||||
qWarning() << "Invalid joint index specified: " << jointIndex;
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ glm::quat MyAvatar::worldToJointRotation(const glm::quat& worldRot, const int jo
|
|||
|
||||
glm::vec3 MyAvatar::jointToWorldPoint(const glm::vec3& jointSpacePos, const int jointIndex) const {
|
||||
glm::vec3 jointPos = getWorldPosition();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getRotation();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getWorldOrientation();//default value if no or invalid joint specified
|
||||
|
||||
if (jointIndex != -1) {
|
||||
if (_skeletonModel->getJointPositionInWorldFrame(jointIndex, jointPos)) {
|
||||
|
@ -836,7 +836,7 @@ glm::vec3 MyAvatar::jointToWorldPoint(const glm::vec3& jointSpacePos, const int
|
|||
}
|
||||
|
||||
glm::vec3 MyAvatar::jointToWorldDirection(const glm::vec3& jointSpaceDir, const int jointIndex) const {
|
||||
glm::quat jointRot = getRotation();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getWorldOrientation();//default value if no or invalid joint specified
|
||||
if ((jointIndex != -1) && (!_skeletonModel->getJointRotationInWorldFrame(jointIndex, jointRot))) {
|
||||
qWarning() << "Invalid joint index specified: " << jointIndex;
|
||||
}
|
||||
|
@ -845,7 +845,7 @@ glm::vec3 MyAvatar::jointToWorldDirection(const glm::vec3& jointSpaceDir, const
|
|||
}
|
||||
|
||||
glm::quat MyAvatar::jointToWorldRotation(const glm::quat& jointSpaceRot, const int jointIndex) const {
|
||||
glm::quat jointRot = getRotation();//default value if no or invalid joint specified
|
||||
glm::quat jointRot = getWorldOrientation();//default value if no or invalid joint specified
|
||||
if ((jointIndex != -1) && (!_skeletonModel->getJointRotationInWorldFrame(jointIndex, jointRot))) {
|
||||
qWarning() << "Invalid joint index specified: " << jointIndex;
|
||||
}
|
||||
|
@ -1301,7 +1301,7 @@ eyeContactTarget MyAvatar::getEyeContactTarget() {
|
|||
}
|
||||
|
||||
glm::vec3 MyAvatar::getDefaultEyePosition() const {
|
||||
return getWorldPosition() + getOrientation() * Quaternions::Y_180 * _skeletonModel->getDefaultEyeModelPosition();
|
||||
return getWorldPosition() + getWorldOrientation() * Quaternions::Y_180 * _skeletonModel->getDefaultEyeModelPosition();
|
||||
}
|
||||
|
||||
const float SCRIPT_PRIORITY = 1.0f + 1.0f;
|
||||
|
@ -1460,7 +1460,7 @@ glm::vec3 MyAvatar::getSkeletonPosition() const {
|
|||
// The avatar is rotated PI about the yAxis, so we have to correct for it
|
||||
// to get the skeleton offset contribution in the world-frame.
|
||||
const glm::quat FLIP = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
return getWorldPosition() + getOrientation() * FLIP * _skeletonOffset;
|
||||
return getWorldPosition() + getWorldOrientation() * FLIP * _skeletonOffset;
|
||||
}
|
||||
return Avatar::getWorldPosition();
|
||||
}
|
||||
|
@ -1508,7 +1508,7 @@ controller::Pose MyAvatar::getControllerPoseInWorldFrame(controller::Action acti
|
|||
controller::Pose MyAvatar::getControllerPoseInAvatarFrame(controller::Action action) const {
|
||||
auto pose = getControllerPoseInWorldFrame(action);
|
||||
if (pose.valid) {
|
||||
glm::mat4 invAvatarMatrix = glm::inverse(createMatFromQuatAndPos(getOrientation(), getWorldPosition()));
|
||||
glm::mat4 invAvatarMatrix = glm::inverse(createMatFromQuatAndPos(getWorldOrientation(), getWorldPosition()));
|
||||
return pose.transform(invAvatarMatrix);
|
||||
} else {
|
||||
return controller::Pose(); // invalid pose
|
||||
|
@ -1527,7 +1527,7 @@ void MyAvatar::updateMotors() {
|
|||
// we decompose camera's rotation and store the twist part in motorRotation
|
||||
// however, we need to perform the decomposition in the avatar-frame
|
||||
// using the local UP axis and then transform back into world-frame
|
||||
glm::quat orientation = getOrientation();
|
||||
glm::quat orientation = getWorldOrientation();
|
||||
glm::quat headOrientation = glm::inverse(orientation) * getMyHead()->getHeadOrientation(); // avatar-frame
|
||||
glm::quat liftRotation;
|
||||
swingTwistDecomposition(headOrientation, Vectors::UNIT_Y, liftRotation, motorRotation);
|
||||
|
@ -1547,7 +1547,7 @@ void MyAvatar::updateMotors() {
|
|||
if (_scriptedMotorFrame == SCRIPTED_MOTOR_CAMERA_FRAME) {
|
||||
motorRotation = getMyHead()->getHeadOrientation() * glm::angleAxis(PI, Vectors::UNIT_Y);
|
||||
} else if (_scriptedMotorFrame == SCRIPTED_MOTOR_AVATAR_FRAME) {
|
||||
motorRotation = getOrientation() * glm::angleAxis(PI, Vectors::UNIT_Y);
|
||||
motorRotation = getWorldOrientation() * glm::angleAxis(PI, Vectors::UNIT_Y);
|
||||
} else {
|
||||
// world-frame
|
||||
motorRotation = glm::quat();
|
||||
|
@ -1575,7 +1575,7 @@ void MyAvatar::prepareForPhysicsSimulation() {
|
|||
_characterController.setParentVelocity(parentVelocity);
|
||||
_characterController.setScaleFactor(getSensorToWorldScale());
|
||||
|
||||
_characterController.setPositionAndOrientation(getWorldPosition(), getOrientation());
|
||||
_characterController.setPositionAndOrientation(getWorldPosition(), getWorldOrientation());
|
||||
auto headPose = getControllerPoseInAvatarFrame(controller::Action::HEAD);
|
||||
if (headPose.isValid()) {
|
||||
_follow.prePhysicsUpdate(*this, deriveBodyFromHMDSensor(), _bodySensorMatrix, hasDriveInput());
|
||||
|
@ -1610,7 +1610,7 @@ void MyAvatar::harvestResultsFromPhysicsSimulation(float deltaTime) {
|
|||
_characterController.getPositionAndOrientation(position, orientation);
|
||||
} else {
|
||||
position = getWorldPosition();
|
||||
orientation = getOrientation();
|
||||
orientation = getWorldOrientation();
|
||||
}
|
||||
nextAttitude(position, orientation);
|
||||
_bodySensorMatrix = _follow.postPhysicsUpdate(*this, _bodySensorMatrix);
|
||||
|
@ -1847,14 +1847,14 @@ void MyAvatar::postUpdate(float deltaTime, const render::ScenePointer& scene) {
|
|||
}
|
||||
|
||||
DebugDraw::getInstance().updateMyAvatarPos(getWorldPosition());
|
||||
DebugDraw::getInstance().updateMyAvatarRot(getOrientation());
|
||||
DebugDraw::getInstance().updateMyAvatarRot(getWorldOrientation());
|
||||
|
||||
AnimPose postUpdateRoomPose(_sensorToWorldMatrix);
|
||||
|
||||
updateHoldActions(_prePhysicsRoomPose, postUpdateRoomPose);
|
||||
|
||||
if (_enableDebugDrawDetailedCollision) {
|
||||
AnimPose rigToWorldPose(glm::vec3(1.0f), getRotation() * Quaternions::Y_180, getWorldPosition());
|
||||
AnimPose rigToWorldPose(glm::vec3(1.0f), getWorldOrientation() * Quaternions::Y_180, getWorldPosition());
|
||||
const int NUM_DEBUG_COLORS = 8;
|
||||
const glm::vec4 DEBUG_COLORS[NUM_DEBUG_COLORS] = {
|
||||
glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
|
||||
|
@ -1972,7 +1972,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
speedFactor = glm::min(speed / _lastDrivenSpeed, 1.0f);
|
||||
}
|
||||
|
||||
float direction = glm::dot(getVelocity(), getRotation() * Vectors::UNIT_NEG_Z) > 0.0f ? 1.0f : -1.0f;
|
||||
float direction = glm::dot(getVelocity(), getWorldOrientation() * Vectors::UNIT_NEG_Z) > 0.0f ? 1.0f : -1.0f;
|
||||
|
||||
float rollAngle = glm::degrees(asinf(glm::dot(IDENTITY_UP, _hmdSensorOrientation * IDENTITY_RIGHT)));
|
||||
float rollSign = rollAngle < 0.0f ? -1.0f : 1.0f;
|
||||
|
@ -1985,12 +1985,12 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
|
||||
// update body orientation by movement inputs
|
||||
glm::quat initialOrientation = getOrientationOutbound();
|
||||
setOrientation(getOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, totalBodyYaw, 0.0f))));
|
||||
setWorldOrientation(getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, totalBodyYaw, 0.0f))));
|
||||
|
||||
if (snapTurn) {
|
||||
// Whether or not there is an existing smoothing going on, just reset the smoothing timer and set the starting position as the avatar's current position, then smooth to the new position.
|
||||
_smoothOrientationInitial = initialOrientation;
|
||||
_smoothOrientationTarget = getOrientation();
|
||||
_smoothOrientationTarget = getWorldOrientation();
|
||||
_smoothOrientationTimer = 0.0f;
|
||||
}
|
||||
|
||||
|
@ -2107,7 +2107,7 @@ void MyAvatar::updatePosition(float deltaTime) {
|
|||
// scan for walkability
|
||||
glm::vec3 position = getWorldPosition();
|
||||
MyCharacterController::RayShotgunResult result;
|
||||
glm::vec3 step = deltaTime * (getRotation() * _actionMotorVelocity);
|
||||
glm::vec3 step = deltaTime * (getWorldOrientation() * _actionMotorVelocity);
|
||||
_characterController.testRayShotgun(position, step, result);
|
||||
_characterController.setStepUpEnabled(result.walkable);
|
||||
}
|
||||
|
@ -2325,7 +2325,7 @@ void MyAvatar::goToLocation(const glm::vec3& newPosition,
|
|||
|
||||
_goToPending = true;
|
||||
_goToPosition = newPosition;
|
||||
_goToOrientation = getOrientation();
|
||||
_goToOrientation = getWorldOrientation();
|
||||
if (hasOrientation) {
|
||||
qCDebug(interfaceapp).nospace() << "MyAvatar goToLocation - new orientation is "
|
||||
<< newOrientation.x << ", " << newOrientation.y << ", " << newOrientation.z << ", " << newOrientation.w;
|
||||
|
@ -2394,7 +2394,7 @@ bool MyAvatar::requiresSafeLanding(const glm::vec3& positionIn, glm::vec3& bette
|
|||
return false; // no entity tree
|
||||
}
|
||||
// More utilities.
|
||||
const auto offset = getOrientation() *_characterController.getCapsuleLocalOffset();
|
||||
const auto offset = getWorldOrientation() *_characterController.getCapsuleLocalOffset();
|
||||
const auto capsuleCenter = positionIn + offset;
|
||||
const auto up = _worldUpDirection, down = -up;
|
||||
glm::vec3 upperIntersection, upperNormal, lowerIntersection, lowerNormal;
|
||||
|
@ -2960,7 +2960,7 @@ glm::mat4 MyAvatar::computeCameraRelativeHandControllerMatrix(const glm::mat4& c
|
|||
glm::mat4 controllerWorldMatrix = getSensorToWorldMatrix() * delta * controllerSensorMatrix;
|
||||
|
||||
// transform controller into avatar space
|
||||
glm::mat4 avatarMatrix = createMatFromQuatAndPos(getOrientation(), getWorldPosition());
|
||||
glm::mat4 avatarMatrix = createMatFromQuatAndPos(getWorldOrientation(), getWorldPosition());
|
||||
return glm::inverse(avatarMatrix) * controllerWorldMatrix;
|
||||
}
|
||||
|
||||
|
@ -3164,7 +3164,7 @@ bool MyAvatar::pinJoint(int index, const glm::vec3& position, const glm::quat& o
|
|||
}
|
||||
|
||||
slamPosition(position);
|
||||
setOrientation(orientation);
|
||||
setWorldOrientation(orientation);
|
||||
|
||||
_skeletonModel->getRig().setMaxHipsOffsetLength(0.05f);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void MyCharacterController::updateShapeIfNecessary() {
|
|||
|
||||
_rigidBody->setSleepingThresholds(0.0f, 0.0f);
|
||||
_rigidBody->setAngularFactor(0.0f);
|
||||
_rigidBody->setWorldTransform(btTransform(glmToBullet(_avatar->getOrientation()),
|
||||
_rigidBody->setWorldTransform(btTransform(glmToBullet(_avatar->getWorldOrientation()),
|
||||
glmToBullet(_avatar->getWorldPosition())));
|
||||
_rigidBody->setDamping(0.0f, 0.0f);
|
||||
if (_state == State::Hover) {
|
||||
|
|
|
@ -39,7 +39,7 @@ glm::quat MyHead::getHeadOrientation() const {
|
|||
return headPose.rotation * Quaternions::Y_180;
|
||||
}
|
||||
|
||||
return myAvatar->getOrientation() * glm::quat(glm::radians(glm::vec3(_basePitch, 0.0f, 0.0f)));
|
||||
return myAvatar->getWorldOrientation() * glm::quat(glm::radians(glm::vec3(_basePitch, 0.0f, 0.0f)));
|
||||
}
|
||||
|
||||
void MyHead::simulate(float deltaTime) {
|
||||
|
|
|
@ -29,7 +29,7 @@ const PickRay JointRayPick::getPickRay(bool& valid) const {
|
|||
glm::vec3 jointPos = useAvatarHead ? myAvatar->getHeadPosition() : myAvatar->getAbsoluteJointTranslationInObjectFrame(jointIndex);
|
||||
glm::quat jointRot = useAvatarHead ? myAvatar->getHeadOrientation() : myAvatar->getAbsoluteJointRotationInObjectFrame(jointIndex);
|
||||
glm::vec3 avatarPos = myAvatar->getWorldPosition();
|
||||
glm::quat avatarRot = myAvatar->getOrientation();
|
||||
glm::quat avatarRot = myAvatar->getWorldOrientation();
|
||||
|
||||
glm::vec3 pos = useAvatarHead ? jointPos : avatarPos + (avatarRot * jointPos);
|
||||
glm::quat rot = useAvatarHead ? jointRot * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT) : avatarRot * jointRot;
|
||||
|
|
|
@ -162,7 +162,7 @@ void LaserPointer::updateRenderState(const RenderState& renderState, const Inter
|
|||
}
|
||||
if (!renderState.getEndID().isNull()) {
|
||||
QVariantMap endProps;
|
||||
glm::quat faceAvatarRotation = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, 180.0f, 0.0f)));
|
||||
glm::quat faceAvatarRotation = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldOrientation() * glm::quat(glm::radians(glm::vec3(0.0f, 180.0f, 0.0f)));
|
||||
glm::vec3 dim = vec3FromVariant(qApp->getOverlays().getProperty(renderState.getEndID(), "dimensions").value);
|
||||
if (_distanceScaleEnd) {
|
||||
dim = renderState.getEndDim() * glm::distance(pickRay.origin, endVec) * DependencyManager::get<AvatarManager>()->getMyAvatar()->getSensorToWorldScale();
|
||||
|
|
|
@ -117,7 +117,7 @@ void Base3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
|||
properties["position"] = vec3toVariant(getWorldPosition());
|
||||
}
|
||||
if (!properties["orientation"].isValid() && !properties["localOrientation"].isValid()) {
|
||||
properties["orientation"] = quatToVariant(getOrientation());
|
||||
properties["orientation"] = quatToVariant(getWorldOrientation());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ QVariant Base3DOverlay::getProperty(const QString& property) {
|
|||
return vec3toVariant(getLocalPosition());
|
||||
}
|
||||
if (property == "rotation" || property == "orientation") {
|
||||
return quatToVariant(getOrientation());
|
||||
return quatToVariant(getWorldOrientation());
|
||||
}
|
||||
if (property == "localRotation" || property == "localOrientation") {
|
||||
return quatToVariant(getLocalOrientation());
|
||||
|
|
|
@ -35,7 +35,7 @@ bool Billboardable::pointTransformAtCamera(Transform& transform, glm::quat offse
|
|||
glm::vec3 billboardPos = transform.getTranslation();
|
||||
glm::vec3 cameraPos = qApp->getCamera().getPosition();
|
||||
// use the referencial from the avatar, y isn't always up
|
||||
glm::vec3 avatarUP = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation()*Vectors::UP;
|
||||
glm::vec3 avatarUP = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldOrientation()*Vectors::UP;
|
||||
|
||||
glm::quat rotation(conjugate(toQuat(glm::lookAt(billboardPos, cameraPos, avatarUP))));
|
||||
|
||||
|
|
|
@ -415,11 +415,11 @@ bool Circle3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::ve
|
|||
|
||||
// Scale the dimensions by the diameter
|
||||
glm::vec2 dimensions = getOuterRadius() * 2.0f * getDimensions();
|
||||
bool intersects = findRayRectangleIntersection(origin, direction, getRotation(), getWorldPosition(), dimensions, distance);
|
||||
bool intersects = findRayRectangleIntersection(origin, direction, getWorldOrientation(), getWorldPosition(), dimensions, distance);
|
||||
|
||||
if (intersects) {
|
||||
glm::vec3 hitPosition = origin + (distance * direction);
|
||||
glm::vec3 localHitPosition = glm::inverse(getRotation()) * (hitPosition - getWorldPosition());
|
||||
glm::vec3 localHitPosition = glm::inverse(getWorldOrientation()) * (hitPosition - getWorldPosition());
|
||||
localHitPosition.x /= getDimensions().x;
|
||||
localHitPosition.y /= getDimensions().y;
|
||||
float distanceToHit = glm::length(localHitPosition);
|
||||
|
|
|
@ -163,7 +163,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
|||
}
|
||||
_contextOverlay->setWorldPosition(contextOverlayPosition);
|
||||
_contextOverlay->setDimensions(contextOverlayDimensions);
|
||||
_contextOverlay->setRotation(entityProperties.getRotation());
|
||||
_contextOverlay->setWorldOrientation(entityProperties.getRotation());
|
||||
_contextOverlay->setVisible(true);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -146,7 +146,7 @@ Transform Cube3DOverlay::evalRenderTransform() {
|
|||
// TODO: handle registration point??
|
||||
glm::vec3 position = getWorldPosition();
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::quat rotation = getRotation();
|
||||
glm::quat rotation = getWorldOrientation();
|
||||
|
||||
Transform transform;
|
||||
transform.setScale(dimensions);
|
||||
|
|
|
@ -146,7 +146,7 @@ void Grid3DOverlay::updateGrid() {
|
|||
|
||||
Transform Grid3DOverlay::evalRenderTransform() {
|
||||
Transform transform;
|
||||
transform.setRotation(getRotation());
|
||||
transform.setRotation(getWorldOrientation());
|
||||
transform.setScale(glm::vec3(getDimensions(), 1.0f));
|
||||
return transform;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ void ModelOverlay::setDrawHUDLayer(bool drawHUDLayer) {
|
|||
|
||||
void ModelOverlay::setProperties(const QVariantMap& properties) {
|
||||
auto origPosition = getWorldPosition();
|
||||
auto origRotation = getRotation();
|
||||
auto origRotation = getWorldOrientation();
|
||||
auto origDimensions = getDimensions();
|
||||
auto origScale = getSNScale();
|
||||
|
||||
|
@ -143,7 +143,7 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
|
|||
_scaleToFit = false;
|
||||
}
|
||||
|
||||
if (origPosition != getWorldPosition() || origRotation != getRotation() || origDimensions != getDimensions() || origScale != getSNScale()) {
|
||||
if (origPosition != getWorldPosition() || origRotation != getWorldOrientation() || origDimensions != getDimensions() || origScale != getSNScale()) {
|
||||
_updateModel = true;
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ void ModelOverlay::locationChanged(bool tellPhysics) {
|
|||
|
||||
// FIXME Start using the _renderTransform instead of calling for Transform and Dimensions from here, do the custom things needed in evalRenderTransform()
|
||||
if (_model && _model->isActive()) {
|
||||
_model->setRotation(getRotation());
|
||||
_model->setRotation(getWorldOrientation());
|
||||
_model->setTranslation(getWorldPosition());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -828,7 +828,7 @@ PointerEvent Overlays::calculateOverlayPointerEvent(OverlayID overlayID, PickRay
|
|||
return PointerEvent();
|
||||
}
|
||||
glm::vec3 position = overlay->getWorldPosition();
|
||||
glm::quat rotation = overlay->getRotation();
|
||||
glm::quat rotation = overlay->getWorldOrientation();
|
||||
glm::vec2 dimensions = overlay->getSize();
|
||||
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace render {
|
|||
if (overlay->getAnchor() == Overlay::MY_AVATAR) {
|
||||
auto batch = args->_batch;
|
||||
auto avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
glm::quat myAvatarRotation = avatar->getOrientation();
|
||||
glm::quat myAvatarRotation = avatar->getWorldOrientation();
|
||||
glm::vec3 myAvatarPosition = avatar->getWorldPosition();
|
||||
float angle = glm::degrees(glm::angle(myAvatarRotation));
|
||||
glm::vec3 axis = glm::axis(myAvatarRotation);
|
||||
|
|
|
@ -69,7 +69,7 @@ QVariant Planar3DOverlay::getProperty(const QString& property) {
|
|||
bool Planar3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||
float& distance, BoxFace& face, glm::vec3& surfaceNormal) {
|
||||
// FIXME - face and surfaceNormal not being returned
|
||||
return findRayRectangleIntersection(origin, direction, getRotation(), getWorldPosition(), getDimensions(), distance);
|
||||
return findRayRectangleIntersection(origin, direction, getWorldOrientation(), getWorldPosition(), getDimensions(), distance);
|
||||
}
|
||||
|
||||
Transform Planar3DOverlay::evalRenderTransform() {
|
||||
|
|
|
@ -61,7 +61,7 @@ void Rectangle3DOverlay::render(RenderArgs* args) {
|
|||
glm::vec3 position = getWorldPosition();
|
||||
glm::vec2 dimensions = getDimensions();
|
||||
glm::vec2 halfDimensions = dimensions * 0.5f;
|
||||
glm::quat rotation = getRotation();
|
||||
glm::quat rotation = getWorldOrientation();
|
||||
|
||||
auto batch = args->_batch;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ Transform Shape3DOverlay::evalRenderTransform() {
|
|||
// TODO: handle registration point??
|
||||
glm::vec3 position = getWorldPosition();
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::quat rotation = getRotation();
|
||||
glm::quat rotation = getWorldOrientation();
|
||||
|
||||
Transform transform;
|
||||
transform.setScale(dimensions);
|
||||
|
|
|
@ -20,7 +20,7 @@ Volume3DOverlay::Volume3DOverlay(const Volume3DOverlay* volume3DOverlay) :
|
|||
|
||||
AABox Volume3DOverlay::getBounds() const {
|
||||
auto extents = Extents{_localBoundingBox};
|
||||
extents.rotate(getRotation());
|
||||
extents.rotate(getWorldOrientation());
|
||||
extents.shiftBy(getWorldPosition());
|
||||
|
||||
return AABox(extents);
|
||||
|
|
|
@ -615,7 +615,7 @@ bool Web3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3&
|
|||
// Don't call applyTransformTo() or setTransform() here because this code runs too frequently.
|
||||
|
||||
// Produce the dimensions of the overlay based on the image's aspect ratio and the overlay's scale.
|
||||
return findRayRectangleIntersection(origin, direction, getRotation(), getWorldPosition(), getSize(), distance);
|
||||
return findRayRectangleIntersection(origin, direction, getWorldOrientation(), getWorldPosition(), getSize(), distance);
|
||||
}
|
||||
|
||||
Web3DOverlay* Web3DOverlay::createClone() const {
|
||||
|
|
|
@ -456,11 +456,11 @@ void Avatar::measureMotionDerivatives(float deltaTime) {
|
|||
setVelocity(velocity);
|
||||
|
||||
// angular
|
||||
glm::quat orientation = getOrientation();
|
||||
glm::quat orientation = getWorldOrientation();
|
||||
glm::quat delta = glm::inverse(_lastOrientation) * orientation;
|
||||
glm::vec3 angularVelocity = glm::axis(delta) * glm::angle(delta) * invDeltaTime;
|
||||
setAngularVelocity(angularVelocity);
|
||||
_lastOrientation = getOrientation();
|
||||
_lastOrientation = getWorldOrientation();
|
||||
}
|
||||
|
||||
enum TextRendererType {
|
||||
|
@ -722,7 +722,7 @@ void Avatar::simulateAttachments(float deltaTime) {
|
|||
if (attachment.isSoft) {
|
||||
// soft attachments do not have transform offsets
|
||||
model->setTranslation(getWorldPosition());
|
||||
model->setRotation(getOrientation() * Quaternions::Y_180);
|
||||
model->setRotation(getWorldOrientation() * Quaternions::Y_180);
|
||||
model->simulate(deltaTime);
|
||||
} else {
|
||||
if (_skeletonModel->getJointPositionInWorldFrame(jointIndex, jointPosition) &&
|
||||
|
@ -902,7 +902,7 @@ glm::vec3 Avatar::getSkeletonPosition() const {
|
|||
// The avatar is rotated PI about the yAxis, so we have to correct for it
|
||||
// to get the skeleton offset contribution in the world-frame.
|
||||
const glm::quat FLIP = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
return getWorldPosition() + getOrientation() * FLIP * _skeletonOffset;
|
||||
return getWorldPosition() + getWorldOrientation() * FLIP * _skeletonOffset;
|
||||
}
|
||||
|
||||
QVector<glm::quat> Avatar::getJointRotations() const {
|
||||
|
@ -1473,11 +1473,11 @@ glm::quat Avatar::getUncachedRightPalmRotation() const {
|
|||
|
||||
void Avatar::setPositionViaScript(const glm::vec3& position) {
|
||||
setWorldPosition(position);
|
||||
updateAttitude(getOrientation());
|
||||
updateAttitude(getWorldOrientation());
|
||||
}
|
||||
|
||||
void Avatar::setOrientationViaScript(const glm::quat& orientation) {
|
||||
setOrientation(orientation);
|
||||
setWorldOrientation(orientation);
|
||||
updateAttitude(orientation);
|
||||
}
|
||||
|
||||
|
|
|
@ -318,8 +318,8 @@ protected:
|
|||
|
||||
void fade(render::Transaction& transaction, render::Transition::Type type);
|
||||
|
||||
glm::vec3 getBodyRightDirection() const { return getOrientation() * IDENTITY_RIGHT; }
|
||||
glm::vec3 getBodyUpDirection() const { return getOrientation() * IDENTITY_UP; }
|
||||
glm::vec3 getBodyRightDirection() const { return getWorldOrientation() * IDENTITY_RIGHT; }
|
||||
glm::vec3 getBodyUpDirection() const { return getWorldOrientation() * IDENTITY_UP; }
|
||||
void measureMotionDerivatives(float deltaTime);
|
||||
|
||||
float getSkeletonHeight() const;
|
||||
|
|
|
@ -253,7 +253,7 @@ void Head::setScale (float scale) {
|
|||
}
|
||||
|
||||
glm::quat Head::getFinalOrientationInWorldFrame() const {
|
||||
return _owningAvatar->getOrientation() * getFinalOrientationInLocalFrame();
|
||||
return _owningAvatar->getWorldOrientation() * getFinalOrientationInLocalFrame();
|
||||
}
|
||||
|
||||
glm::quat Head::getFinalOrientationInLocalFrame() const {
|
||||
|
|
|
@ -127,7 +127,7 @@ void SkeletonModel::updateAttitude(const glm::quat& orientation) {
|
|||
// Called by Avatar::simulate after it has set the joint states (fullUpdate true if changed),
|
||||
// but just before head has been simulated.
|
||||
void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||
updateAttitude(_owningAvatar->getOrientation());
|
||||
updateAttitude(_owningAvatar->getWorldOrientation());
|
||||
if (fullUpdate) {
|
||||
setBlendshapeCoefficients(_owningAvatar->getHead()->getSummedBlendshapeCoefficients());
|
||||
|
||||
|
|
|
@ -118,12 +118,12 @@ void AvatarData::setTargetScale(float targetScale) {
|
|||
}
|
||||
|
||||
glm::vec3 AvatarData::getHandPosition() const {
|
||||
return getOrientation() * _handPosition + getWorldPosition();
|
||||
return getWorldOrientation() * _handPosition + getWorldPosition();
|
||||
}
|
||||
|
||||
void AvatarData::setHandPosition(const glm::vec3& handPosition) {
|
||||
// store relative to position/orientation
|
||||
_handPosition = glm::inverse(getOrientation()) * (handPosition - getWorldPosition());
|
||||
_handPosition = glm::inverse(getWorldOrientation()) * (handPosition - getWorldPosition());
|
||||
}
|
||||
|
||||
void AvatarData::lazyInitHeadData() const {
|
||||
|
@ -1900,7 +1900,7 @@ void registerAvatarTypes(QScriptEngine* engine) {
|
|||
void AvatarData::setRecordingBasis(std::shared_ptr<Transform> recordingBasis) {
|
||||
if (!recordingBasis) {
|
||||
recordingBasis = std::make_shared<Transform>();
|
||||
recordingBasis->setRotation(getOrientation());
|
||||
recordingBasis->setRotation(getWorldOrientation());
|
||||
recordingBasis->setTranslation(getWorldPosition());
|
||||
// TODO: find a different way to record/playback the Scale of the avatar
|
||||
//recordingBasis->setScale(getTargetScale());
|
||||
|
@ -2066,7 +2066,7 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) {
|
|||
setWorldPosition(currentBasis->getTranslation());
|
||||
orientation = currentBasis->getRotation();
|
||||
}
|
||||
setOrientation(orientation);
|
||||
setWorldOrientation(orientation);
|
||||
updateAttitude(orientation);
|
||||
|
||||
// Do after avatar orientation because head look-at needs avatar orientation.
|
||||
|
@ -2153,36 +2153,36 @@ void AvatarData::fromFrame(const QByteArray& frameData, AvatarData& result, bool
|
|||
}
|
||||
|
||||
float AvatarData::getBodyYaw() const {
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getOrientation()));
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getWorldOrientation()));
|
||||
return eulerAngles.y;
|
||||
}
|
||||
|
||||
void AvatarData::setBodyYaw(float bodyYaw) {
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getOrientation()));
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getWorldOrientation()));
|
||||
eulerAngles.y = bodyYaw;
|
||||
setOrientation(glm::quat(glm::radians(eulerAngles)));
|
||||
setWorldOrientation(glm::quat(glm::radians(eulerAngles)));
|
||||
}
|
||||
|
||||
float AvatarData::getBodyPitch() const {
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getOrientation()));
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getWorldOrientation()));
|
||||
return eulerAngles.x;
|
||||
}
|
||||
|
||||
void AvatarData::setBodyPitch(float bodyPitch) {
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getOrientation()));
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getWorldOrientation()));
|
||||
eulerAngles.x = bodyPitch;
|
||||
setOrientation(glm::quat(glm::radians(eulerAngles)));
|
||||
setWorldOrientation(glm::quat(glm::radians(eulerAngles)));
|
||||
}
|
||||
|
||||
float AvatarData::getBodyRoll() const {
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getOrientation()));
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getWorldOrientation()));
|
||||
return eulerAngles.z;
|
||||
}
|
||||
|
||||
void AvatarData::setBodyRoll(float bodyRoll) {
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getOrientation()));
|
||||
glm::vec3 eulerAngles = glm::degrees(safeEulerAngles(getWorldOrientation()));
|
||||
eulerAngles.z = bodyRoll;
|
||||
setOrientation(glm::quat(glm::radians(eulerAngles)));
|
||||
setWorldOrientation(glm::quat(glm::radians(eulerAngles)));
|
||||
}
|
||||
|
||||
void AvatarData::setPositionViaScript(const glm::vec3& position) {
|
||||
|
@ -2190,7 +2190,7 @@ void AvatarData::setPositionViaScript(const glm::vec3& position) {
|
|||
}
|
||||
|
||||
void AvatarData::setOrientationViaScript(const glm::quat& orientation) {
|
||||
SpatiallyNestable::setOrientation(orientation);
|
||||
SpatiallyNestable::setWorldOrientation(orientation);
|
||||
}
|
||||
|
||||
glm::quat AvatarData::getAbsoluteJointRotationInObjectFrame(int index) const {
|
||||
|
|
|
@ -359,7 +359,7 @@ class AvatarData : public QObject, public SpatiallyNestable {
|
|||
Q_PROPERTY(float bodyPitch READ getBodyPitch WRITE setBodyPitch)
|
||||
Q_PROPERTY(float bodyRoll READ getBodyRoll WRITE setBodyRoll)
|
||||
|
||||
Q_PROPERTY(glm::quat orientation READ getOrientation WRITE setOrientationViaScript)
|
||||
Q_PROPERTY(glm::quat orientation READ getWorldOrientation WRITE setOrientationViaScript)
|
||||
Q_PROPERTY(glm::quat headOrientation READ getHeadOrientation WRITE setHeadOrientation)
|
||||
Q_PROPERTY(float headPitch READ getHeadPitch WRITE setHeadPitch)
|
||||
Q_PROPERTY(float headYaw READ getHeadYaw WRITE setHeadYaw)
|
||||
|
|
|
@ -49,11 +49,11 @@ void HeadData::setRawOrientation(const glm::quat& q) {
|
|||
|
||||
|
||||
glm::quat HeadData::getOrientation() const {
|
||||
return _owningAvatar->getOrientation() * getRawOrientation();
|
||||
return _owningAvatar->getWorldOrientation() * getRawOrientation();
|
||||
}
|
||||
|
||||
void HeadData::setHeadOrientation(const glm::quat& orientation) {
|
||||
glm::quat bodyOrientation = _owningAvatar->getOrientation();
|
||||
glm::quat bodyOrientation = _owningAvatar->getWorldOrientation();
|
||||
glm::vec3 eulers = glm::degrees(safeEulerAngles(glm::inverse(bodyOrientation) * orientation));
|
||||
_basePitch = eulers.x;
|
||||
_baseYaw = eulers.y;
|
||||
|
@ -62,10 +62,10 @@ void HeadData::setHeadOrientation(const glm::quat& orientation) {
|
|||
|
||||
void HeadData::setOrientation(const glm::quat& orientation) {
|
||||
// rotate body about vertical axis
|
||||
glm::quat bodyOrientation = _owningAvatar->getOrientation();
|
||||
glm::quat bodyOrientation = _owningAvatar->getWorldOrientation();
|
||||
glm::vec3 newForward = glm::inverse(bodyOrientation) * (orientation * IDENTITY_FORWARD);
|
||||
bodyOrientation = bodyOrientation * glm::angleAxis(atan2f(-newForward.x, -newForward.z), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
_owningAvatar->setOrientation(bodyOrientation);
|
||||
_owningAvatar->setWorldOrientation(bodyOrientation);
|
||||
|
||||
// the rest goes to the head
|
||||
setHeadOrientation(orientation);
|
||||
|
@ -154,7 +154,7 @@ QJsonObject HeadData::toJson() const {
|
|||
}
|
||||
auto lookat = getLookAtPosition();
|
||||
if (lookat != vec3()) {
|
||||
vec3 relativeLookAt = glm::inverse(_owningAvatar->getOrientation()) *
|
||||
vec3 relativeLookAt = glm::inverse(_owningAvatar->getWorldOrientation()) *
|
||||
(getLookAtPosition() - _owningAvatar->getWorldPosition());
|
||||
headJson[JSON_AVATAR_HEAD_LOOKAT] = toJsonValue(relativeLookAt);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void HeadData::fromJson(const QJsonObject& json) {
|
|||
if (json.contains(JSON_AVATAR_HEAD_LOOKAT)) {
|
||||
auto relativeLookAt = vec3FromJsonValue(json[JSON_AVATAR_HEAD_LOOKAT]);
|
||||
if (glm::length2(relativeLookAt) > 0.01f) {
|
||||
setLookAtPosition((_owningAvatar->getOrientation() * relativeLookAt) + _owningAvatar->getWorldPosition());
|
||||
setLookAtPosition((_owningAvatar->getWorldOrientation() * relativeLookAt) + _owningAvatar->getWorldPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ float ScriptAvatarData::getBodyRoll() const {
|
|||
}
|
||||
glm::quat ScriptAvatarData::getOrientation() const {
|
||||
if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) {
|
||||
return sharedAvatarData->getOrientation();
|
||||
return sharedAvatarData->getWorldOrientation();
|
||||
} else {
|
||||
return glm::quat();
|
||||
}
|
||||
|
|
|
@ -510,7 +510,7 @@ static glm::vec2 projectOntoEntityXYPlane(EntityItemPointer entity, const PickRa
|
|||
if (entity) {
|
||||
|
||||
glm::vec3 entityPosition = entity->getWorldPosition();
|
||||
glm::quat entityRotation = entity->getRotation();
|
||||
glm::quat entityRotation = entity->getWorldOrientation();
|
||||
glm::vec3 entityDimensions = entity->getDimensions();
|
||||
glm::vec3 entityRegistrationPoint = entity->getRegistrationPoint();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ void LightEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint
|
|||
|
||||
auto light = lightPayload.editLight();
|
||||
light->setPosition(entity->getWorldPosition());
|
||||
light->setOrientation(entity->getRotation());
|
||||
light->setOrientation(entity->getWorldOrientation());
|
||||
|
||||
bool success;
|
||||
lightPayload.editBound() = entity->getAABox(success);
|
||||
|
|
|
@ -123,7 +123,7 @@ void RenderableModelEntityItem::doInitialModelSimulation() {
|
|||
// now recalculate the bounds and registration
|
||||
model->setScaleToFit(true, getDimensions());
|
||||
model->setSnapModelToRegistrationPoint(true, getRegistrationPoint());
|
||||
model->setRotation(getRotation());
|
||||
model->setRotation(getWorldOrientation());
|
||||
model->setTranslation(getWorldPosition());
|
||||
|
||||
if (_needsInitialSimulation) {
|
||||
|
|
|
@ -155,7 +155,7 @@ void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
|
|||
|
||||
_polylineTransform = Transform();
|
||||
_polylineTransform.setTranslation(entity->getWorldPosition());
|
||||
_polylineTransform.setRotation(entity->getRotation());
|
||||
_polylineTransform.setRotation(entity->getWorldOrientation());
|
||||
|
||||
if (pointsChanged) {
|
||||
_lastPoints = entity->getLinePoints();
|
||||
|
|
|
@ -247,7 +247,7 @@ glm::mat4 RenderablePolyVoxEntityItem::localToVoxelMatrix() const {
|
|||
}
|
||||
|
||||
glm::mat4 RenderablePolyVoxEntityItem::voxelToWorldMatrix() const {
|
||||
glm::mat4 rotation = glm::mat4_cast(getRotation());
|
||||
glm::mat4 rotation = glm::mat4_cast(getWorldOrientation());
|
||||
glm::mat4 translation = glm::translate(getWorldPosition());
|
||||
return translation * rotation * voxelToLocalMatrix();
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
_shape = entity->getShape();
|
||||
_position = entity->getWorldPosition();
|
||||
_dimensions = entity->getDimensions();
|
||||
_orientation = entity->getOrientation();
|
||||
_orientation = entity->getWorldOrientation();
|
||||
_renderTransform = getModelTransform();
|
||||
|
||||
if (_shape == entity::Sphere) {
|
||||
|
|
|
@ -201,7 +201,7 @@ void ZoneEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen
|
|||
|
||||
entity->resetRenderingPropertiesChanged();
|
||||
_lastPosition = entity->getWorldPosition();
|
||||
_lastRotation = entity->getRotation();
|
||||
_lastRotation = entity->getWorldOrientation();
|
||||
_lastDimensions = entity->getDimensions();
|
||||
|
||||
_keyLightProperties = entity->getKeyLightProperties();
|
||||
|
@ -277,7 +277,7 @@ bool ZoneEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoint
|
|||
if (entity->getDimensions() != _lastDimensions) {
|
||||
return true;
|
||||
}
|
||||
if (entity->getRotation() != _lastRotation) {
|
||||
if (entity->getWorldOrientation() != _lastRotation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1169,7 +1169,7 @@ bool EntityItem::wantTerseEditLogging() const {
|
|||
|
||||
glm::mat4 EntityItem::getEntityToWorldMatrix() const {
|
||||
glm::mat4 translation = glm::translate(getWorldPosition());
|
||||
glm::mat4 rotation = glm::mat4_cast(getRotation());
|
||||
glm::mat4 rotation = glm::mat4_cast(getWorldOrientation());
|
||||
glm::mat4 scale = glm::scale(getDimensions());
|
||||
glm::mat4 registration = glm::translate(ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint());
|
||||
return translation * rotation * scale * registration;
|
||||
|
@ -1464,7 +1464,7 @@ AACube EntityItem::getMinimumAACube(bool& success) const {
|
|||
glm::vec3 unrotatedMinRelativeToEntity = - (dimensions * _registrationPoint);
|
||||
glm::vec3 unrotatedMaxRelativeToEntity = dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint);
|
||||
Extents extents = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity };
|
||||
extents.rotate(getRotation());
|
||||
extents.rotate(getWorldOrientation());
|
||||
|
||||
// shift the extents to be relative to the position/registration point
|
||||
extents.shiftBy(position);
|
||||
|
@ -1494,7 +1494,7 @@ AABox EntityItem::getAABox(bool& success) const {
|
|||
glm::vec3 unrotatedMinRelativeToEntity = - (dimensions * _registrationPoint);
|
||||
glm::vec3 unrotatedMaxRelativeToEntity = dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint);
|
||||
Extents extents = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity };
|
||||
extents.rotate(getRotation());
|
||||
extents.rotate(getWorldOrientation());
|
||||
|
||||
// shift the extents to be relative to the position/registration point
|
||||
extents.shiftBy(position);
|
||||
|
@ -2384,7 +2384,7 @@ void EntityItem::globalizeProperties(EntityItemProperties& properties, const QSt
|
|||
auto globalPosition = getWorldPosition(success);
|
||||
if (success) {
|
||||
properties.setPosition(globalPosition + offset);
|
||||
properties.setRotation(getRotation());
|
||||
properties.setRotation(getWorldOrientation());
|
||||
properties.setDimensions(getDimensions());
|
||||
// Should we do velocities and accelerations, too? This could end up being quite involved, which is why the method exists.
|
||||
} else {
|
||||
|
|
|
@ -388,7 +388,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
|||
properties.setPosition(entity->getWorldPosition());
|
||||
}
|
||||
if (!scriptSideProperties.localRotationChanged() && !scriptSideProperties.rotationChanged()) {
|
||||
properties.setRotation(entity->getOrientation());
|
||||
properties.setRotation(entity->getWorldOrientation());
|
||||
}
|
||||
}
|
||||
properties = convertLocationFromScriptSemantics(properties);
|
||||
|
@ -1798,7 +1798,7 @@ glm::mat4 EntityScriptingInterface::getEntityTransform(const QUuid& entityID) {
|
|||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(EntityItemID(entityID));
|
||||
if (entity) {
|
||||
glm::mat4 translation = glm::translate(entity->getWorldPosition());
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getRotation());
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getWorldOrientation());
|
||||
result = translation * rotation;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -662,7 +662,7 @@ bool EntityTreeElement::findDetailedRayIntersection(const glm::vec3& origin, con
|
|||
}
|
||||
|
||||
// extents is the entity relative, scaled, centered extents of the entity
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getRotation());
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getWorldOrientation());
|
||||
glm::mat4 translation = glm::translate(entity->getWorldPosition());
|
||||
glm::mat4 entityToWorldMatrix = translation * rotation;
|
||||
glm::mat4 worldToEntityMatrix = glm::inverse(entityToWorldMatrix);
|
||||
|
@ -787,7 +787,7 @@ void EntityTreeElement::getEntities(const glm::vec3& searchPosition, float searc
|
|||
} else {
|
||||
// determine the worldToEntityMatrix that doesn't include scale because
|
||||
// we're going to use the registration aware aa box in the entity frame
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getRotation());
|
||||
glm::mat4 rotation = glm::mat4_cast(entity->getWorldOrientation());
|
||||
glm::mat4 translation = glm::translate(entity->getWorldPosition());
|
||||
glm::mat4 entityToWorldMatrix = translation * rotation;
|
||||
glm::mat4 worldToEntityMatrix = glm::inverse(entityToWorldMatrix);
|
||||
|
|
|
@ -411,7 +411,7 @@ glm::mat4 PolyVoxEntityItem::localToVoxelMatrix() const {
|
|||
}
|
||||
|
||||
glm::mat4 PolyVoxEntityItem::voxelToWorldMatrix() const {
|
||||
glm::mat4 rotation = glm::mat4_cast(getRotation());
|
||||
glm::mat4 rotation = glm::mat4_cast(getWorldOrientation());
|
||||
glm::mat4 translation = glm::translate(getWorldPosition());
|
||||
return translation * rotation * voxelToLocalMatrix();
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ bool TextEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const
|
|||
void** intersectedObject, bool precisionPicking) const {
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::vec2 xyDimensions(dimensions.x, dimensions.y);
|
||||
glm::quat rotation = getRotation();
|
||||
glm::quat rotation = getWorldOrientation();
|
||||
glm::vec3 position = getWorldPosition() + rotation *
|
||||
(dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint()));
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g
|
|||
void** intersectedObject, bool precisionPicking) const {
|
||||
glm::vec3 dimensions = getDimensions();
|
||||
glm::vec2 xyDimensions(dimensions.x, dimensions.y);
|
||||
glm::quat rotation = getRotation();
|
||||
glm::quat rotation = getWorldOrientation();
|
||||
glm::vec3 position = getWorldPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint()));
|
||||
|
||||
if (findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance)) {
|
||||
|
|
|
@ -109,7 +109,7 @@ void EntityMotionState::handleDeactivation() {
|
|||
// and also to RigidBody
|
||||
btTransform worldTrans;
|
||||
worldTrans.setOrigin(glmToBullet(_entity->getWorldPosition()));
|
||||
worldTrans.setRotation(glmToBullet(_entity->getRotation()));
|
||||
worldTrans.setRotation(glmToBullet(_entity->getWorldOrientation()));
|
||||
_body->setWorldTransform(worldTrans);
|
||||
// no need to update velocities... should already be zero
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
|
|||
_accelerationNearlyGravityCount = (uint8_t)(-1);
|
||||
}
|
||||
worldTrans.setOrigin(glmToBullet(getObjectPosition()));
|
||||
worldTrans.setRotation(glmToBullet(_entity->getRotation()));
|
||||
worldTrans.setRotation(glmToBullet(_entity->getWorldOrientation()));
|
||||
}
|
||||
|
||||
// This callback is invoked by the physics simulation at the end of each simulation step...
|
||||
|
@ -264,7 +264,7 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
|||
qCDebug(physics) << "EntityMotionState::setWorldTransform setPosition failed" << _entity->getID();
|
||||
}
|
||||
bool orientationSuccess;
|
||||
_entity->setOrientation(bulletToGLM(worldTrans.getRotation()), orientationSuccess, false);
|
||||
_entity->setWorldOrientation(bulletToGLM(worldTrans.getRotation()), orientationSuccess, false);
|
||||
if (!orientationSuccess) {
|
||||
static QString repeatedMessage =
|
||||
LogHandler::getInstance().addRepeatedMessageRegex("EntityMotionState::setWorldTransform "
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual float getObjectAngularDamping() const override { return _entity->getAngularDamping(); }
|
||||
|
||||
virtual glm::vec3 getObjectPosition() const override { return _entity->getWorldPosition() - ObjectMotionState::getWorldOffset(); }
|
||||
virtual glm::quat getObjectRotation() const override { return _entity->getRotation(); }
|
||||
virtual glm::quat getObjectRotation() const override { return _entity->getWorldOrientation(); }
|
||||
virtual glm::vec3 getObjectLinearVelocity() const override { return _entity->getVelocity(); }
|
||||
virtual glm::vec3 getObjectAngularVelocity() const override { return _entity->getAngularVelocity(); }
|
||||
virtual glm::vec3 getObjectGravity() const override { return _entity->getGravity(); }
|
||||
|
|
|
@ -54,8 +54,8 @@ bool ObjectActionTractor::getTarget(float deltaTimeStep, glm::quat& rotation, gl
|
|||
|
||||
if (!_otherID.isNull()) {
|
||||
if (other) {
|
||||
rotation = _desiredRotationalTarget * other->getRotation();
|
||||
position = other->getRotation() * _desiredPositionalTarget + other->getWorldPosition();
|
||||
rotation = _desiredRotationalTarget * other->getWorldOrientation();
|
||||
position = other->getWorldOrientation() * _desiredPositionalTarget + other->getWorldPosition();
|
||||
} else {
|
||||
// we should have an "other" but can't find it, so disable the tractor.
|
||||
linearTimeScale = FLT_MAX;
|
||||
|
|
|
@ -420,13 +420,13 @@ void SpatiallyNestable::setWorldPosition(const glm::vec3& position) {
|
|||
#endif
|
||||
}
|
||||
|
||||
glm::quat SpatiallyNestable::getOrientation(bool& success) const {
|
||||
glm::quat SpatiallyNestable::getWorldOrientation(bool& success) const {
|
||||
return getTransform(success).getRotation();
|
||||
}
|
||||
|
||||
glm::quat SpatiallyNestable::getOrientation() const {
|
||||
glm::quat SpatiallyNestable::getWorldOrientation() const {
|
||||
bool success;
|
||||
auto result = getOrientation(success);
|
||||
auto result = getWorldOrientation(success);
|
||||
#ifdef WANT_DEBUG
|
||||
if (!success) {
|
||||
qCDebug(shared) << "Warning -- getOrientation failed" << getID();
|
||||
|
@ -435,11 +435,11 @@ glm::quat SpatiallyNestable::getOrientation() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
glm::quat SpatiallyNestable::getOrientation(int jointIndex, bool& success) const {
|
||||
glm::quat SpatiallyNestable::getWorldOrientation(int jointIndex, bool& success) const {
|
||||
return getTransform(jointIndex, success).getRotation();
|
||||
}
|
||||
|
||||
void SpatiallyNestable::setOrientation(const glm::quat& orientation, bool& success, bool tellPhysics) {
|
||||
void SpatiallyNestable::setWorldOrientation(const glm::quat& orientation, bool& success, bool tellPhysics) {
|
||||
// guard against introducing NaN into the transform
|
||||
if (isNaN(orientation)) {
|
||||
success = false;
|
||||
|
@ -463,9 +463,9 @@ void SpatiallyNestable::setOrientation(const glm::quat& orientation, bool& succe
|
|||
}
|
||||
}
|
||||
|
||||
void SpatiallyNestable::setOrientation(const glm::quat& orientation) {
|
||||
void SpatiallyNestable::setWorldOrientation(const glm::quat& orientation) {
|
||||
bool success;
|
||||
setOrientation(orientation, success);
|
||||
setWorldOrientation(orientation, success);
|
||||
#ifdef WANT_DEBUG
|
||||
if (!success) {
|
||||
qCDebug(shared) << "Warning -- setOrientation failed" << getID();
|
||||
|
|
|
@ -83,15 +83,11 @@ public:
|
|||
virtual void setWorldPosition(const glm::vec3& position, bool& success, bool tellPhysics = true);
|
||||
virtual void setWorldPosition(const glm::vec3& position);
|
||||
|
||||
virtual glm::quat getOrientation(bool& success) const;
|
||||
virtual glm::quat getOrientation() const;
|
||||
virtual glm::quat getOrientation(int jointIndex, bool& success) const;
|
||||
virtual void setOrientation(const glm::quat& orientation, bool& success, bool tellPhysics = true);
|
||||
virtual void setOrientation(const glm::quat& orientation);
|
||||
|
||||
// these are here because some older code uses rotation rather than orientation
|
||||
virtual const glm::quat getRotation() const { return getOrientation(); }
|
||||
virtual void setRotation(glm::quat orientation) { setOrientation(orientation); }
|
||||
virtual glm::quat getWorldOrientation(bool& success) const;
|
||||
virtual glm::quat getWorldOrientation() const;
|
||||
virtual glm::quat getWorldOrientation(int jointIndex, bool& success) const;
|
||||
virtual void setWorldOrientation(const glm::quat& orientation, bool& success, bool tellPhysics = true);
|
||||
virtual void setWorldOrientation(const glm::quat& orientation);
|
||||
|
||||
virtual glm::vec3 getVelocity(bool& success) const;
|
||||
virtual glm::vec3 getVelocity() const;
|
||||
|
|
Loading…
Reference in a new issue