mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:08:47 +02:00
include noncollidable entities
This commit is contained in:
parent
b8a7fce201
commit
d7b3686364
4 changed files with 14 additions and 12 deletions
|
@ -1736,7 +1736,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
connect(&_myCamera, &Camera::modeUpdated, this, &Application::cameraModeChanged);
|
connect(&_myCamera, &Camera::modeUpdated, this, &Application::cameraModeChanged);
|
||||||
|
|
||||||
// Setup the mouse ray pick and related operators
|
// Setup the mouse ray pick and related operators
|
||||||
DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickID(_rayPickManager.createRayPick(RayPickFilter(RayPickFilter::PICK_ENTITIES), 0.0f, true));
|
DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickID(_rayPickManager.createRayPick(
|
||||||
|
RayPickFilter(DependencyManager::get<RayPickScriptingInterface>()->PICK_ENTITIES() | DependencyManager::get<RayPickScriptingInterface>()->PICK_INCLUDE_NONCOLLIDABLE()),
|
||||||
|
0.0f, true));
|
||||||
DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickResultOperator([&](QUuid rayPickID) {
|
DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickResultOperator([&](QUuid rayPickID) {
|
||||||
RayToEntityIntersectionResult entityResult;
|
RayToEntityIntersectionResult entityResult;
|
||||||
RayPickResult result = _rayPickManager.getPrevRayPickResult(rayPickID);
|
RayPickResult result = _rayPickManager.getPrevRayPickResult(rayPickID);
|
||||||
|
|
|
@ -47,6 +47,8 @@ public:
|
||||||
bool operator== (const RayPickFilter& rhs) const { return _flags == rhs._flags; }
|
bool operator== (const RayPickFilter& rhs) const { return _flags == rhs._flags; }
|
||||||
bool operator!= (const RayPickFilter& rhs) const { return _flags != rhs._flags; }
|
bool operator!= (const RayPickFilter& rhs) const { return _flags != rhs._flags; }
|
||||||
|
|
||||||
|
void setFlag(FlagBit flag, bool value) { _flags[flag] = value; }
|
||||||
|
|
||||||
bool doesPickNothing() const { return _flags[PICK_NOTHING]; }
|
bool doesPickNothing() const { return _flags[PICK_NOTHING]; }
|
||||||
bool doesPickEntities() const { return _flags[PICK_ENTITIES]; }
|
bool doesPickEntities() const { return _flags[PICK_ENTITIES]; }
|
||||||
bool doesPickOverlays() const { return _flags[PICK_OVERLAYS]; }
|
bool doesPickOverlays() const { return _flags[PICK_OVERLAYS]; }
|
||||||
|
@ -102,8 +104,7 @@ public:
|
||||||
bool isEnabled() { return _enabled; }
|
bool isEnabled() { return _enabled; }
|
||||||
const RayPickResult& getPrevRayPickResult() { return _prevResult; }
|
const RayPickResult& getPrevRayPickResult() { return _prevResult; }
|
||||||
|
|
||||||
void setPrecisionPicking(bool precisionPicking) { _precisionPicking = precisionPicking; }
|
void setPrecisionPicking(bool precisionPicking) { _filter.setFlag(RayPickFilter::PICK_COURSE, !precisionPicking); }
|
||||||
bool doesPrecisionPicking() { return _precisionPicking; }
|
|
||||||
|
|
||||||
void setRayPickResult(const RayPickResult& rayPickResult) { _prevResult = rayPickResult; }
|
void setRayPickResult(const RayPickResult& rayPickResult) { _prevResult = rayPickResult; }
|
||||||
|
|
||||||
|
@ -126,7 +127,6 @@ private:
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
RayPickResult _prevResult;
|
RayPickResult _prevResult;
|
||||||
|
|
||||||
bool _precisionPicking { true };
|
|
||||||
QVector<EntityItemID> _ignoreEntities;
|
QVector<EntityItemID> _ignoreEntities;
|
||||||
QVector<EntityItemID> _includeEntities;
|
QVector<EntityItemID> _includeEntities;
|
||||||
QVector<OverlayID> _ignoreOverlays;
|
QVector<OverlayID> _ignoreOverlays;
|
||||||
|
|
|
@ -64,11 +64,11 @@ void RayPickManager::update() {
|
||||||
RayToEntityIntersectionResult entityRes;
|
RayToEntityIntersectionResult entityRes;
|
||||||
bool fromCache = true;
|
bool fromCache = true;
|
||||||
bool invisible = rayPick->getFilter().doesPickInvisible();
|
bool invisible = rayPick->getFilter().doesPickInvisible();
|
||||||
bool noncollidable = rayPick->getFilter().doesPickNonCollidable();
|
bool nonCollidable = rayPick->getFilter().doesPickNonCollidable();
|
||||||
RayPickFilter::Flags entityMask = rayPick->getFilter().getEntityFlags();
|
RayPickFilter::Flags entityMask = rayPick->getFilter().getEntityFlags();
|
||||||
if (!checkAndCompareCachedResults(rayKey, results, res, entityMask)) {
|
if (!checkAndCompareCachedResults(rayKey, results, res, entityMask)) {
|
||||||
entityRes = DependencyManager::get<EntityScriptingInterface>()->findRayIntersectionVector(ray, rayPick->doesPrecisionPicking(),
|
entityRes = DependencyManager::get<EntityScriptingInterface>()->findRayIntersectionVector(ray, !rayPick->getFilter().doesPickCourse(),
|
||||||
rayPick->getIncludeEntites(), rayPick->getIgnoreEntites(), !invisible, !noncollidable);
|
rayPick->getIncludeEntites(), rayPick->getIgnoreEntites(), !invisible, !nonCollidable);
|
||||||
fromCache = false;
|
fromCache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ void RayPickManager::update() {
|
||||||
RayToOverlayIntersectionResult overlayRes;
|
RayToOverlayIntersectionResult overlayRes;
|
||||||
bool fromCache = true;
|
bool fromCache = true;
|
||||||
bool invisible = rayPick->getFilter().doesPickInvisible();
|
bool invisible = rayPick->getFilter().doesPickInvisible();
|
||||||
bool noncollidable = rayPick->getFilter().doesPickNonCollidable();
|
bool nonCollidable = rayPick->getFilter().doesPickNonCollidable();
|
||||||
RayPickFilter::Flags overlayMask = rayPick->getFilter().getOverlayFlags();
|
RayPickFilter::Flags overlayMask = rayPick->getFilter().getOverlayFlags();
|
||||||
if (!checkAndCompareCachedResults(rayKey, results, res, overlayMask)) {
|
if (!checkAndCompareCachedResults(rayKey, results, res, overlayMask)) {
|
||||||
overlayRes = qApp->getOverlays().findRayIntersectionVector(ray, rayPick->doesPrecisionPicking(),
|
overlayRes = qApp->getOverlays().findRayIntersectionVector(ray, !rayPick->getFilter().doesPickCourse(),
|
||||||
rayPick->getIncludeOverlays(), rayPick->getIgnoreOverlays(), !invisible, !noncollidable);
|
rayPick->getIncludeOverlays(), rayPick->getIgnoreOverlays(), !invisible, !nonCollidable);
|
||||||
fromCache = false;
|
fromCache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1182,7 +1182,7 @@ function MyController(hand) {
|
||||||
this.fullEnd = fullEnd;
|
this.fullEnd = fullEnd;
|
||||||
this.laserPointer = LaserPointers.createLaserPointer({
|
this.laserPointer = LaserPointers.createLaserPointer({
|
||||||
joint: (hand == RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
|
joint: (hand == RIGHT_HAND) ? "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND",
|
||||||
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS,
|
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS | RayPick.PICK_INCLUDE_NONCOLLIDABLE,
|
||||||
maxDistance: PICK_MAX_DISTANCE,
|
maxDistance: PICK_MAX_DISTANCE,
|
||||||
posOffset: getGrabPointSphereOffset(this.handToController()),
|
posOffset: getGrabPointSphereOffset(this.handToController()),
|
||||||
renderStates: renderStates,
|
renderStates: renderStates,
|
||||||
|
@ -1191,7 +1191,7 @@ function MyController(hand) {
|
||||||
});
|
});
|
||||||
this.headLaserPointer = LaserPointers.createLaserPointer({
|
this.headLaserPointer = LaserPointers.createLaserPointer({
|
||||||
joint: "Avatar",
|
joint: "Avatar",
|
||||||
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS,
|
filter: RayPick.PICK_ENTITIES | RayPick.PICK_OVERLAYS | RayPick.PICK_INCLUDE_NONCOLLIDABLE,
|
||||||
maxDistance: PICK_MAX_DISTANCE,
|
maxDistance: PICK_MAX_DISTANCE,
|
||||||
renderStates: headRenderStates,
|
renderStates: headRenderStates,
|
||||||
faceAvatar: true,
|
faceAvatar: true,
|
||||||
|
|
Loading…
Reference in a new issue