mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
*** empty log message ***
This commit is contained in:
parent
029f99a1cc
commit
22fe2af816
@ -659,19 +659,16 @@ class SelectionSphere(SelectionQueue):
|
|||||||
|
|
||||||
def isEntryBackfacing(self, entry):
|
def isEntryBackfacing(self, entry):
|
||||||
# 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, we are
|
# ray from sphere origin to collision point is positive,
|
||||||
# looking at the backface of the polygon
|
# center is on the backside of the polygon
|
||||||
ip = entry.getFromIntersectionPoint()
|
|
||||||
c = entry.getFrom().getCenter()
|
|
||||||
n = entry.getFromSurfaceNormal()
|
|
||||||
v = Vec3(entry.getFromIntersectionPoint() -
|
v = Vec3(entry.getFromIntersectionPoint() -
|
||||||
entry.getFrom().getCenter())
|
entry.getFrom().getCenter())
|
||||||
# Normalize and check angle between to vectors
|
n = entry.getFromSurfaceNormal()
|
||||||
print '(%0.2f, %0.2f, %0.2f), (%0.2f, %0.2f, %0.2f), (%0.2f, %0.2f, %0.2f), %0.2f' %(ip[0],ip[1],ip[2],c[0],c[1],c[2],n[0],n[1],n[2], v.dot(n))
|
# If points almost on top of each other, reject face
|
||||||
|
# (treat as backfacing)
|
||||||
if v.length() < 0.05:
|
if v.length() < 0.05:
|
||||||
# Points almost on top of each other,
|
|
||||||
# reject face (treat as backfacing)
|
|
||||||
return 1
|
return 1
|
||||||
|
# Normalize and check angle between to vectors
|
||||||
v.normalize()
|
v.normalize()
|
||||||
return v.dot(n) >= 0
|
return v.dot(n) >= 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user