本文整理汇总了C++中SortedVector::setAllowDuplicateInsertPlan方法的典型用法代码示例。如果您正苦于以下问题:C++ SortedVector::setAllowDuplicateInsertPlan方法的具体用法?C++ SortedVector::setAllowDuplicateInsertPlan怎么用?C++ SortedVector::setAllowDuplicateInsertPlan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedVector
的用法示例。
在下文中一共展示了SortedVector::setAllowDuplicateInsertPlan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkMovementCollision
bool CollisionManager::checkMovementCollision(CreatureObject* creature, float x, float z, float y, Zone* zone) {
SortedVector<ManagedReference<QuadTreeEntry*> > closeObjects;
zone->getInRangeObjects(x, y, 128, &closeObjects, true);
//Vector3 rayStart(x, z + 0.25, y);
//Vector3 rayStart(creature->getWorldPositionX(), creature->getWorldPositionZ(), creature->getPos)
Vector3 rayStart = creature->getWorldPosition();
rayStart.set(rayStart.getX(), rayStart.getY(), rayStart.getZ() + 0.25f);
//Vector3 rayEnd(x + System::random(512), z + 0.3f, y + System::random(512));
/*Vector3 rayEnd;
rayEnd.set(targetPosition.getX(), targetPosition.getY(), targetPosition.getZ());*/
Vector3 rayEnd(x, z + 0.25, y);
float maxDistance = rayEnd.distanceTo(rayStart);
if (maxDistance == 0)
return false;
printf("%f\n", maxDistance);
SortedVector<IntersectionResult> results;
results.setAllowDuplicateInsertPlan();
printf("starting test\n");
Triangle* triangle;
for (int i = 0; i < closeObjects.size(); ++i) {
SceneObject* object = dynamic_cast<SceneObject*>(closeObjects.get(i).get());
if (object == NULL)
continue;
AABBTree* tree = getAABBTree(object, 255);
if (tree == NULL)
continue;
Ray ray = convertToModelSpace(rayStart, rayEnd, object);
//results.removeAll(10, 10);
//ordered by intersection distance
//tree->intersects(ray, maxDistance, results);
float intersectionDistance;
if (tree->intersects(ray, maxDistance, intersectionDistance, triangle, true)) {
String str = object->getObjectTemplate()->getFullTemplateString();
object->info("intersecting with me " + str, true);
return true;
}
}
return false;
}