@@ -138,14 +138,24 @@ THREE.Ray = function ( origin, direction, near, far ) {
138
138
rangeSq = this . range * this . range ,
139
139
geometry = object . geometry ,
140
140
vertices = geometry . vertices ,
141
- objMatrix ;
141
+ objMatrix , geometryMaterials ,
142
+ isFaceMaterial , material , side ;
143
+
144
+ geometryMaterials = object . geometry . materials ;
145
+ isFaceMaterial = object . material instanceof THREE . MeshFaceMaterial ;
146
+ side = object . material . side ;
142
147
143
148
object . matrixRotationWorld . extractRotation ( object . matrixWorld ) ;
144
149
145
150
for ( f = 0 , fl = geometry . faces . length ; f < fl ; f ++ ) {
146
151
147
152
face = geometry . faces [ f ] ;
148
153
154
+ material = isFaceMaterial === true ? geometryMaterials [ face . materialIndex ] : object . material ;
155
+ if ( material === undefined ) continue ;
156
+
157
+ side = material . side ;
158
+
149
159
originCopy . copy ( this . origin ) ;
150
160
directionCopy . copy ( this . direction ) ;
151
161
@@ -170,7 +180,7 @@ THREE.Ray = function ( origin, direction, near, far ) {
170
180
171
181
if ( scalar < 0 ) continue ;
172
182
173
- if ( object . doubleSided || ( object . flipSided ? dot > 0 : dot < 0 ) ) {
183
+ if ( side === THREE . DoubleSide || ( side === THREE . FrontSide ? dot < 0 : dot > 0 ) ) {
174
184
175
185
intersectPoint . add ( originCopy , directionCopy . multiplyScalar ( scalar ) ) ;
176
186
0 commit comments