@@ -60,7 +60,10 @@ export class LiteBoxColliderShape extends LiteColliderShape implements IBoxColli
60
60
/**
61
61
* {@inheritDoc IColliderShape.pointDistance }
62
62
*/
63
- override pointDistance ( position : Vector3 , rotation : Quaternion , point : Vector3 ) : Vector4 {
63
+ override pointDistance ( point : Vector3 ) : Vector4 {
64
+ const position = LiteColliderShape . _tempPos ;
65
+ const rotation = LiteColliderShape . _tempRot ;
66
+ this . _transform . worldMatrix . decompose ( position , rotation , LiteColliderShape . _tempScale ) ;
64
67
const { position : shapePosition } = this . _transform ;
65
68
const m = LiteBoxColliderShape . _tempMatrix ;
66
69
const invM = LiteBoxColliderShape . _tempInvMatrix ;
@@ -71,10 +74,12 @@ export class LiteBoxColliderShape extends LiteColliderShape implements IBoxColli
71
74
const { _boxMin, _boxMax } = this ;
72
75
p . copyFrom ( _boxMin ) ;
73
76
p . subtract ( shapePosition ) ;
74
- boundingBox . min . set ( p . x / scale . x , p . y / scale . y , p . z / scale . z ) ;
77
+ p . divide ( scale ) ;
78
+ boundingBox . min . copyFrom ( p ) ;
75
79
p . copyFrom ( _boxMax ) ;
76
80
p . subtract ( shapePosition ) ;
77
- boundingBox . max . set ( p . x / scale . x , p . y / scale . y , p . z / scale . z ) ;
81
+ p . divide ( scale ) ;
82
+ boundingBox . max . copyFrom ( p ) ;
78
83
79
84
Matrix . affineTransformation ( scale , rotation , position , m ) ;
80
85
Matrix . invert ( m , invM ) ;
0 commit comments