|
@@ -490,12 +490,13 @@ class SelectionQueue(CollisionHandlerQueue):
|
|
|
# If dot product of collision point surface normal and
|
|
# If dot product of collision point surface normal and
|
|
|
# ray from camera to collision point is positive, we are
|
|
# ray from camera to collision point is positive, we are
|
|
|
# looking at the backface of the polygon
|
|
# looking at the backface of the polygon
|
|
|
- if not entry.hasFromSurfaceNormal():
|
|
|
|
|
|
|
+ if not entry.hasSurfaceNormal():
|
|
|
# Well, no way to tell. Assume we're not backfacing.
|
|
# Well, no way to tell. Assume we're not backfacing.
|
|
|
return 0
|
|
return 0
|
|
|
-
|
|
|
|
|
- v = Vec3(entry.getFromIntersectionPoint())
|
|
|
|
|
- n = entry.getFromSurfaceNormal()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ fromNodePath = entry.getFromNodePath()
|
|
|
|
|
+ v = Vec3(entry.getSurfacePoint(fromNodePath))
|
|
|
|
|
+ n = entry.getSurfaceNormal(fromNodePath)
|
|
|
# Convert to camera space for backfacing test
|
|
# Convert to camera space for backfacing test
|
|
|
if self.collisionNodePath.getParent() != base.cam:
|
|
if self.collisionNodePath.getParent() != base.cam:
|
|
|
# Problem: assumes base.cam is the camera in question
|
|
# Problem: assumes base.cam is the camera in question
|
|
@@ -687,9 +688,10 @@ class SelectionSphere(SelectionQueue):
|
|
|
# If dot product of collision point surface normal and
|
|
# If dot product of collision point surface normal and
|
|
|
# ray from sphere origin to collision point is positive,
|
|
# ray from sphere origin to collision point is positive,
|
|
|
# center is on the backside of the polygon
|
|
# center is on the backside of the polygon
|
|
|
- v = Vec3(entry.getFromIntersectionPoint() -
|
|
|
|
|
|
|
+ fromNodePath = entry.getFromNodePath()
|
|
|
|
|
+ v = Vec3(entry.getSurfacePoint(fromNodePath) -
|
|
|
entry.getFrom().getCenter())
|
|
entry.getFrom().getCenter())
|
|
|
- n = entry.getFromSurfaceNormal()
|
|
|
|
|
|
|
+ n = entry.getSurfaceNormal(fromNodePath)
|
|
|
# If points almost on top of each other, reject face
|
|
# If points almost on top of each other, reject face
|
|
|
# (treat as backfacing)
|
|
# (treat as backfacing)
|
|
|
if v.length() < 0.05:
|
|
if v.length() < 0.05:
|