code review

This commit is contained in:
Seth Alves 2017-05-11 10:13:15 -07:00
parent 4042e2bceb
commit 80e6edda0c
4 changed files with 16 additions and 9 deletions

View file

@ -1611,13 +1611,14 @@ bool EntityTree::sendEntitiesOperation(OctreeElementPointer element, void* extra
if (oldID.isNull()) {
return EntityItemID();
}
if (args->map->contains(oldID)) {
return EntityItemID(args->map->value(oldID));
} else {
QHash<EntityItemID, EntityItemID>::iterator iter = args->map->find(oldID);
if (iter == args->map->end()) {
EntityItemID newID = QUuid::createUuid();
args->map->insert(oldID, newID);
return newID;
}
return iter.value();
};
entityTreeElement->forEachEntity([&args, &getMapped, &element](EntityItemPointer item) {

View file

@ -27,6 +27,8 @@ ObjectActionMotor::ObjectActionMotor(const QUuid& id, EntityItemPointer ownerEnt
#if WANT_DEBUG
qCDebug(physics) << "ObjectActionMotor::ObjectActionMotor";
#endif
qCWarning(physics) << "action type \"motor\" doesn't yet work.";
}
ObjectActionMotor::~ObjectActionMotor() {

View file

@ -108,8 +108,8 @@ btTypedConstraint* ObjectConstraintSlider::getConstraint() {
axisInB = glm::normalize(axisInB);
}
glm::quat rotA = glm::rotation(glm::vec3(1.0f, 0.0f, 0.0f), axisInA);
glm::quat rotB = glm::rotation(glm::vec3(1.0f, 0.0f, 0.0f), axisInB);
glm::quat rotA = glm::rotation(DEFAULT_SLIDER_AXIS, axisInA);
glm::quat rotB = glm::rotation(DEFAULT_SLIDER_AXIS, axisInB);
btTransform frameInA(glmToBullet(rotA), glmToBullet(pointInA));
btTransform frameInB(glmToBullet(rotB), glmToBullet(pointInB));
@ -123,7 +123,7 @@ btTypedConstraint* ObjectConstraintSlider::getConstraint() {
} else {
// This slider is between an entity and the world-frame.
glm::quat rot = glm::rotation(glm::vec3(1.0f, 0.0f, 0.0f), axisInA);
glm::quat rot = glm::rotation(DEFAULT_SLIDER_AXIS, axisInA);
btTransform frameInA(glmToBullet(rot), glmToBullet(pointInA));

View file

@ -32,10 +32,14 @@ void ObjectDynamic::remapIDs(QHash<EntityItemID, EntityItemID>& map) {
}
if (!_otherID.isNull()) {
if (!map.contains(_otherID)) {
map.insert(_otherID, QUuid::createUuid());
QHash<EntityItemID, EntityItemID>::iterator iter = map.find(_otherID);
if (iter == map.end()) {
// not found, add it
_otherID = QUuid::createUuid();
map.insert(_otherID, _otherID);
} else {
_otherID = iter.value();
}
_otherID = map.value(_otherID);
}
});
}