@@ -13,7 +13,7 @@ var vec2 = require('../math/vec2')
13
13
, Convex = require ( '../shapes/Convex' )
14
14
, Shape = require ( '../shapes/Shape' )
15
15
, Body = require ( '../objects/Body' )
16
- , Rectangle = require ( '../shapes/Rectangle ' ) ;
16
+ , Box = require ( '../shapes/Box ' ) ;
17
17
18
18
module . exports = Narrowphase ;
19
19
@@ -386,29 +386,29 @@ Narrowphase.prototype.convexLine = function(
386
386
} ;
387
387
388
388
/**
389
- * Line/rectangle narrowphase
390
- * @method lineRectangle
389
+ * Line/box narrowphase
390
+ * @method lineBox
391
391
* @param {Body } lineBody
392
392
* @param {Line } lineShape
393
393
* @param {Array } lineOffset
394
394
* @param {Number } lineAngle
395
- * @param {Body } rectangleBody
396
- * @param {Rectangle } rectangleShape
397
- * @param {Array } rectangleOffset
398
- * @param {Number } rectangleAngle
395
+ * @param {Body } boxBody
396
+ * @param {Box } boxShape
397
+ * @param {Array } boxOffset
398
+ * @param {Number } boxAngle
399
399
* @param {Boolean } justTest
400
400
* @todo Implement me!
401
401
*/
402
- Narrowphase . prototype [ Shape . LINE | Shape . RECTANGLE ] =
403
- Narrowphase . prototype . lineRectangle = function (
402
+ Narrowphase . prototype [ Shape . LINE | Shape . BOX ] =
403
+ Narrowphase . prototype . lineBox = function (
404
404
lineBody ,
405
405
lineShape ,
406
406
lineOffset ,
407
407
lineAngle ,
408
- rectangleBody ,
409
- rectangleShape ,
410
- rectangleOffset ,
411
- rectangleAngle ,
408
+ boxBody ,
409
+ boxShape ,
410
+ boxOffset ,
411
+ boxAngle ,
412
412
justTest
413
413
) {
414
414
// TODO
@@ -426,7 +426,7 @@ function setConvexToCapsuleShapeMiddle(convexShape, capsuleShape){
426
426
vec2 . set ( convexShape . vertices [ 3 ] , - capsuleShape . length * 0.5 , capsuleShape . radius ) ;
427
427
}
428
428
429
- var convexCapsule_tempRect = new Rectangle ( 1 , 1 ) ,
429
+ var convexCapsule_tempRect = new Box ( { width : 1 , height : 1 } ) ,
430
430
convexCapsule_tempVec = vec2 . create ( ) ;
431
431
432
432
/**
@@ -442,7 +442,7 @@ var convexCapsule_tempRect = new Rectangle(1,1),
442
442
* @param {Number } capsuleAngle
443
443
*/
444
444
Narrowphase . prototype [ Shape . CAPSULE | Shape . CONVEX ] =
445
- Narrowphase . prototype [ Shape . CAPSULE | Shape . RECTANGLE ] =
445
+ Narrowphase . prototype [ Shape . CAPSULE | Shape . BOX ] =
446
446
Narrowphase . prototype . convexCapsule = function (
447
447
convexBody ,
448
448
convexShape ,
@@ -515,7 +515,7 @@ Narrowphase.prototype.lineCapsule = function(
515
515
516
516
var capsuleCapsule_tempVec1 = vec2 . create ( ) ;
517
517
var capsuleCapsule_tempVec2 = vec2 . create ( ) ;
518
- var capsuleCapsule_tempRect1 = new Rectangle ( 1 , 1 ) ;
518
+ var capsuleCapsule_tempRect1 = new Box ( { width : 1 , height : 1 } ) ;
519
519
520
520
/**
521
521
* Capsule/capsule narrowphase
@@ -581,7 +581,7 @@ Narrowphase.prototype.capsuleCapsule = function(bi,si,xi,ai, bj,sj,xj,aj, justTe
581
581
this . enableFriction = false ;
582
582
}
583
583
584
- // Check circles against the center rectangles
584
+ // Check circles against the center boxs
585
585
var rect = capsuleCapsule_tempRect1 ;
586
586
setConvexToCapsuleShapeMiddle ( rect , si ) ;
587
587
var result1 = this . convexCapsule ( bi , rect , xi , ai , bj , sj , xj , aj , justTest ) ;
@@ -979,7 +979,7 @@ Narrowphase.prototype.circleCapsule = function(bi,si,xi,ai, bj,sj,xj,aj, justTes
979
979
* @param {Number } circleRadius
980
980
*/
981
981
Narrowphase . prototype [ Shape . CIRCLE | Shape . CONVEX ] =
982
- Narrowphase . prototype [ Shape . CIRCLE | Shape . RECTANGLE ] =
982
+ Narrowphase . prototype [ Shape . CIRCLE | Shape . BOX ] =
983
983
Narrowphase . prototype . circleConvex = function (
984
984
circleBody ,
985
985
circleShape ,
@@ -1191,7 +1191,7 @@ function pointInConvex(worldPoint,convexShape,convexOffset,convexAngle){
1191
1191
* @todo don't transform each vertex, but transform the particle position to convex-local instead
1192
1192
*/
1193
1193
Narrowphase . prototype [ Shape . PARTICLE | Shape . CONVEX ] =
1194
- Narrowphase . prototype [ Shape . PARTICLE | Shape . RECTANGLE ] =
1194
+ Narrowphase . prototype [ Shape . PARTICLE | Shape . BOX ] =
1195
1195
Narrowphase . prototype . particleConvex = function (
1196
1196
particleBody ,
1197
1197
particleShape ,
@@ -1384,7 +1384,7 @@ Narrowphase.prototype.circleCircle = function(
1384
1384
* @param {Boolean } justTest
1385
1385
*/
1386
1386
Narrowphase . prototype [ Shape . PLANE | Shape . CONVEX ] =
1387
- Narrowphase . prototype [ Shape . PLANE | Shape . RECTANGLE ] =
1387
+ Narrowphase . prototype [ Shape . PLANE | Shape . BOX ] =
1388
1388
Narrowphase . prototype . planeConvex = function (
1389
1389
planeBody ,
1390
1390
planeShape ,
@@ -1574,7 +1574,7 @@ Narrowphase.prototype.circleParticle = function(
1574
1574
return 1 ;
1575
1575
} ;
1576
1576
1577
- var planeCapsule_tmpCircle = new Circle ( 1 ) ,
1577
+ var planeCapsule_tmpCircle = new Circle ( { radius : 1 } ) ,
1578
1578
planeCapsule_tmp1 = vec2 . create ( ) ,
1579
1579
planeCapsule_tmp2 = vec2 . create ( ) ,
1580
1580
planeCapsule_tmp3 = vec2 . create ( ) ;
@@ -1732,8 +1732,8 @@ Narrowphase.prototype.circlePlane = function( bi,si,xi,ai, bj,sj,xj,aj, justTe
1732
1732
* @param {Number } aj
1733
1733
*/
1734
1734
Narrowphase . prototype [ Shape . CONVEX ] =
1735
- Narrowphase . prototype [ Shape . CONVEX | Shape . RECTANGLE ] =
1736
- Narrowphase . prototype [ Shape . RECTANGLE ] =
1735
+ Narrowphase . prototype [ Shape . CONVEX | Shape . BOX ] =
1736
+ Narrowphase . prototype [ Shape . BOX ] =
1737
1737
Narrowphase . prototype . convexConvex = function ( bi , si , xi , ai , bj , sj , xj , aj , justTest , precision ) {
1738
1738
var sepAxis = tmp1 ,
1739
1739
worldPoint = tmp2 ,
@@ -1977,7 +1977,7 @@ Narrowphase.findSeparatingAxis = function(c1,offset1,angle1,c2,offset2,angle2,se
1977
1977
span1 = fsa_tmp5 ,
1978
1978
span2 = fsa_tmp6 ;
1979
1979
1980
- if ( c1 instanceof Rectangle && c2 instanceof Rectangle ) {
1980
+ if ( c1 instanceof Box && c2 instanceof Box ) {
1981
1981
1982
1982
for ( var j = 0 ; j !== 2 ; j ++ ) {
1983
1983
var c = c1 ,
@@ -2186,7 +2186,7 @@ var circleHeightfield_candidate = vec2.create(),
2186
2186
Narrowphase . prototype [ Shape . CIRCLE | Shape . HEIGHTFIELD ] =
2187
2187
Narrowphase . prototype . circleHeightfield = function ( circleBody , circleShape , circlePos , circleAngle ,
2188
2188
hfBody , hfShape , hfPos , hfAngle , justTest , radius ) {
2189
- var data = hfShape . data ,
2189
+ var data = hfShape . heights ,
2190
2190
radius = radius || circleShape . radius ,
2191
2191
w = hfShape . elementWidth ,
2192
2192
dist = circleHeightfield_dist ,
@@ -2351,7 +2351,7 @@ Narrowphase.prototype.circleHeightfield = function( circleBody,circleShape,circl
2351
2351
var convexHeightfield_v0 = vec2 . create ( ) ,
2352
2352
convexHeightfield_v1 = vec2 . create ( ) ,
2353
2353
convexHeightfield_tilePos = vec2 . create ( ) ,
2354
- convexHeightfield_tempConvexShape = new Convex ( [ vec2 . create ( ) , vec2 . create ( ) , vec2 . create ( ) , vec2 . create ( ) ] ) ;
2354
+ convexHeightfield_tempConvexShape = new Convex ( { vertices : [ vec2 . create ( ) , vec2 . create ( ) , vec2 . create ( ) , vec2 . create ( ) ] } ) ;
2355
2355
/**
2356
2356
* @method circleHeightfield
2357
2357
* @param {Body } bi
@@ -2362,11 +2362,11 @@ var convexHeightfield_v0 = vec2.create(),
2362
2362
* @param {Array } xj
2363
2363
* @param {Number } aj
2364
2364
*/
2365
- Narrowphase . prototype [ Shape . RECTANGLE | Shape . HEIGHTFIELD ] =
2365
+ Narrowphase . prototype [ Shape . BOX | Shape . HEIGHTFIELD ] =
2366
2366
Narrowphase . prototype [ Shape . CONVEX | Shape . HEIGHTFIELD ] =
2367
2367
Narrowphase . prototype . convexHeightfield = function ( convexBody , convexShape , convexPos , convexAngle ,
2368
2368
hfBody , hfShape , hfPos , hfAngle , justTest ) {
2369
- var data = hfShape . data ,
2369
+ var data = hfShape . heights ,
2370
2370
w = hfShape . elementWidth ,
2371
2371
v0 = convexHeightfield_v0 ,
2372
2372
v1 = convexHeightfield_v1 ,
0 commit comments