Jump to content

JS error while using convertCollisionObjects


CrowBot
 Share

Recommended Posts

JSON:

 



{
"height":33,
"name":"Collision",
"objects":[
{
"height":0,
"name":"",
"polyline":[
{
"x":0,
"y":0
},
{
"x":0,
"y":24
},
{
"x":24,
"y":24
},
{
"x":24,
"y":48
},
{
"x":48,
"y":48
},
{
"x":48,
"y":72
},
{
"x":72,
"y":72
},
{
"x":96,
"y":96
},
{
"x":96,
"y":144
},
{
"x":72,
"y":168
},
{
"x":72,
"y":216
},
{
"x":96,
"y":216
},
{
"x":144,
"y":264
},
{
"x":144,
"y":288
},
{
"x":96,
"y":336
},
{
"x":96,
"y":360
},
{
"x":72,
"y":384
},
{
"x":72,
"y":432
},
{
"x":96,
"y":432
},
{
"x":96,
"y":456
},
{
"x":120,
"y":456
},
{
"x":120,
"y":504
},
{
"x":144,
"y":504
},
{
"x":144,
"y":552
},
{
"x":192,
"y":552
},
{
"x":192,
"y":624
},
{
"x":240,
"y":624
},
{
"x":288,
"y":672
},
{
"x":288,
"y":720
},
{
"x":336,
"y":720
},
{
"x":336,
"y":744
},
{
"x":384,
"y":744
},
{
"x":408,
"y":768
},
{
"x":408,
"y":792
},
{
"x":-24,
"y":792
},
{
"x":-24,
"y":0
},
{
"x":0,
"y":0
}],
"properties":
{

},
"type":"",
"visible":true,
"width":0,
"x":24,
"y":0
},
{
"height":0,
"name":"",
"polyline":[
{
"x":0,
"y":0
},
{
"x":0,
"y":48
},
{
"x":-24,
"y":48
},
{
"x":-48,
"y":72
},
{
"x":-48,
"y":96
},
{
"x":24,
"y":96
},
{
"x":24,
"y":120
},
{
"x":96,
"y":120
},
{
"x":96,
"y":168
},
{
"x":144,
"y":168
},
{
"x":144,
"y":216
},
{
"x":96,
"y":216
},
{
"x":72,
"y":240
},
{
"x":24,
"y":288
},
{
"x":24,
"y":360
},
{
"x":48,
"y":384
},
{
"x":72,
"y":384
},
{
"x":72,
"y":432
},
{
"x":96,
"y":432
},
{
"x":96,
"y":480
},
{
"x":120,
"y":480
},
{
"x":120,
"y":504
},
{
"x":144,
"y":504
},
{
"x":144,
"y":528
},
{
"x":168,
"y":528
},
{
"x":168,
"y":576
},
{
"x":144,
"y":600
},
{
"x":120,
"y":624
},
{
"x":120,
"y":720
},
{
"x":96,
"y":720
},
{
"x":48,
"y":768
},
{
"x":48,
"y":792
},
{
"x":192,
"y":792
},
{
"x":192,
"y":0
},
{
"x":0,
"y":0
}],
"properties":
{

},
"type":"",
"visible":true,
"width":0,
"x":576,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"width":32,
"x":0,
"y":0
},


 

var walls = game.physics.p2.convertCollisionObjects(map, "Collision", true);

 

Point.area = function(a,b,c){

    return (((b[0] - a[0])*(c[1] - a[1]))-((c[0] - a[0])*(b[1] - a[1])));

};

 

Uncaught TypeError: Cannot read property '0' of undefined

 

Not sure what's going on with this... no idea whats causing the error. Any help?

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...