SpatiallyNestable: warn on failure.

This commit is contained in:
Anthony J. Thibault 2016-02-09 14:03:39 -08:00
parent 6a82594a4f
commit 2b10fea006
2 changed files with 29 additions and 4 deletions

View file

@ -1080,7 +1080,13 @@ void MyAvatar::prepareForPhysicsSimulation() {
relayDriveKeysToCharacterController();
bool success;
_characterController.setParentVelocity(getParentVelocity(success));
glm::vec3 parentVelocity = getParentVelocity(success);
if (!success) {
qDebug() << "Warning: getParentVelocity failed" << getID();
parentVelocity = glm::vec3();
}
_characterController.setParentVelocity(parentVelocity);
_characterController.setTargetVelocity(getTargetVelocity());
_characterController.setPositionAndOrientation(getPosition(), getOrientation());
if (qApp->isHMDMode()) {

View file

@ -404,7 +404,11 @@ glm::vec3 SpatiallyNestable::getVelocity(bool& success) const {
glm::vec3 SpatiallyNestable::getVelocity() const {
bool success;
return getVelocity(success);
glm::vec3 result = getVelocity(success);
if (!success) {
qDebug() << "Warning -- setVelocity failed" << getID();
}
return result;
}
void SpatiallyNestable::setVelocity(const glm::vec3& velocity, bool& success) {
@ -419,6 +423,9 @@ void SpatiallyNestable::setVelocity(const glm::vec3& velocity, bool& success) {
void SpatiallyNestable::setVelocity(const glm::vec3& velocity) {
bool success;
setVelocity(velocity, success);
if (!success) {
qDebug() << "Warning -- setVelocity failed" << getID();
}
}
glm::vec3 SpatiallyNestable::getParentVelocity(bool& success) const {
@ -442,7 +449,11 @@ glm::vec3 SpatiallyNestable::getAngularVelocity(bool& success) const {
glm::vec3 SpatiallyNestable::getAngularVelocity() const {
bool success;
return getAngularVelocity(success);
glm::vec3 result = getAngularVelocity(success);
if (!success) {
qDebug() << "Warning -- getAngularVelocity failed" << getID();
}
return result;
}
void SpatiallyNestable::setAngularVelocity(const glm::vec3& angularVelocity, bool& success) {
@ -456,10 +467,18 @@ void SpatiallyNestable::setAngularVelocity(const glm::vec3& angularVelocity, boo
void SpatiallyNestable::setAngularVelocity(const glm::vec3& angularVelocity) {
bool success;
setAngularVelocity(angularVelocity, success);
if (!success) {
qDebug() << "Warning -- setAngularVelocity failed" << getID();
}
}
glm::vec3 SpatiallyNestable::getParentAngularVelocity(bool& success) const {
return glm::vec3();
glm::vec3 result;
SpatiallyNestablePointer parent = getParentPointer(success);
if (success && parent) {
result = parent->getAngularVelocity(success);
}
return result;
}
const Transform SpatiallyNestable::getTransform(bool& success) const {