[SOLVED]Collision not working on cloned entity

Hello, i have an entity (static) with rigidbody(static too) and collision component, i clone it with the following code

                        this.wall=app.root.findByName('Wall');
                        var cwall = this.wall.clone();
                        app.root.addChild(cwall);
                        cwall.enabled = true;
                        cwall.rotate(0,this.build[i].r,0);
                        cwall.rigidbody.teleport(this.build[i].x,this.build[i].y,this.build[i].z);
                        cwall.tags.add('wall');

but the player keep on passing through the wall, the same code works well for houses, can’t understand why
https://playcanvas.com/editor/code/352037/terrain.js

Are you using any scaling?
If you just add the wall in the scene via the editor, do you still pass through it?

Yes @yaustar just checked, i pass through also in the original wall enabled in the editor :frowning: how is that? and yes i scale it 51,51,25

The physics rigid body is separate from the entity scale. So you have to resize the rigid body based on the how big the model is in the world.

1 Like

uh? how do i do that? edIt: the collision component is mesh, move it to a child and use the box i can scale it easy, but this line don’t work cwall.rigidbody.teleport(this.build[i].x,this.build[i].y,this.build[i].z);

Ok solved, changed the collision component to box in the main entity (luckly they matched enough) and it’s all ok. Unless a way to rescale the mesh collision too wouldn’t be bad. Thanks @yaustar.