Hello,
I am dynamically resizing a very basic room model, which has a mesh collider, upon a button click based on the height and width of a div element. The room resizes perfectly, but when I try to move around it(first person movement script), I abruptly come to a halt when there is obviously a lot of room left to cover. As far as I know, mesh colliders should resize based on the scale of the entity correct?
My code is as follows:-
Ui.prototype.initialize = function () {
// create STYLE element
let style = document.createElement('style');
// append to head
document.head.appendChild(style);
style.innerHTML = this.css.resource || '';
let bstyle = document.createElement('style');
document.head.appendChild(bstyle);
bstyle.innerHTML = this.Bcss.resource || '';
// Add the HTML
this.div = document.createElement('div');
this.div.classList.add('container');
this.div.innerHTML = this.html.resource || '';
// append to body
// can be appended somewhere else
// it is recommended to have some container element
// to prevent iOS problems of overfloating elements off the screen
let self = this;
document.body.appendChild(this.div);
$("#CONV_BUTTON").click(function(){
let width = $('#resizer').width();
let height = $('#resizer').height();
let room = self.app.root.findByName("RoomWithRoof");
room.enabled = true;
room.setLocalScale(width/10, 5, height/10);
self.app.root.findByName("Player").enabled = true;
self.app.root.findByName("camera").enabled = false;
self.entity.enabled = false;
});
};
Project can be found @ https://playcanvas.com/editor/scene/943414/. When launched, press âConvert To 3Dâ and then use WASD and mouse to move to repro the bug. Why is this happening?