https://playcanvas.com/editor/scene/1201252
Hopefully a simple problem, I’m still learning the API and messing around here, so it shouldn’t be too difficult.
I start with a box in my scene which I clone in a 10x10 square to make a ground, the original box has a collision component and a rigidbody component, and I’ve checked and the cloned boxes also appear to start with collision components and rigidbody components. Then when the ball falls on the boxes it doesn’t collide or detect a collision, which I’ve checked with console.log()'s.
Here’s the code that’s meant to clone the boxes
if(this.entity.parent.children.length == 7){
var blocks = [];
for(var x = 0; x < 10; x++){
blocks[x] = [];
for(var z = 0; z < 10; z++){
blocks[x][z] = this.entity.clone();
this.entity.parent.addChild(blocks[x][z]);
blocks[x][z].setPosition(x, 1, z);
}
}
this.entity.destroy();
}
I’ve tried adding a new collision component and rigidbody component and I got warning messages that those components were already a part of the cloned entities, and also they didn’t work. My working theory is that while the entities are cloned and moved visibly the rigidbodies are for some reason not being moved.
I could use any help I can get, thanks.