make hasAncestorOfType understand AVATAR_SELF_ID

This commit is contained in:
Seth Alves 2017-02-03 16:14:15 -08:00
parent 174c674fd3
commit c7200d2d3a
2 changed files with 13 additions and 3 deletions

View file

@ -199,12 +199,15 @@ void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
return;
}
assert(entityTreeIsLocked());
if (_motionType == MOTION_TYPE_KINEMATIC && !_entity->hasAncestorOfType(NestableType::Avatar)) {
if (_motionType == MOTION_TYPE_KINEMATIC) {
BT_PROFILE("kinematicIntegration");
// This is physical kinematic motion which steps strictly by the subframe count
// of the physics simulation and uses full gravity for acceleration.
_entity->setAcceleration(_entity->getGravity());
if (_entity->hasAncestorOfType(NestableType::Avatar)) {
_entity->setAcceleration(glm::vec3(0.0f));
} else {
_entity->setAcceleration(_entity->getGravity());
}
uint32_t thisStep = ObjectMotionState::getWorldSimulationStep();
float dt = (thisStep - _lastKinematicStep) * PHYSICS_ENGINE_FIXED_SUBSTEP;
_entity->stepKinematicMotion(dt);

View file

@ -1034,6 +1034,13 @@ AACube SpatiallyNestable::getQueryAACube() const {
bool SpatiallyNestable::hasAncestorOfType(NestableType nestableType) const {
bool success;
if (nestableType == NestableType::Avatar) {
QUuid parentID = getParentID();
if (parentID == AVATAR_SELF_ID) {
return true;
}
}
SpatiallyNestablePointer parent = getParentPointer(success);
if (!success || !parent) {
return false;