Hi!
Introduction:
I am working on a small project that allows me to create a little house for the countryside (they are small houses for watering, storing tools and etc…). The project aims to be a small assistant to help you build your own concrete house.
It is still in a very early phase.
Problem description
I have a problem that I have not been able to solve. I have a cube with a collision component and when I modify its sizes by code, the collision does not take effect. Example of code:
} else if (elementName === "inputZ") {
this.entity.setLocalScale(this.entity.getLocalScale().x, this.entity.getLocalScale().y, value / 100);
}
// Apply new collision
var currentScale = this.entity.getLocalScale();
var newHalfExtents = new pc.Vec3(currentScale.x / 2, currentScale.y / 2, currentScale.z / 2);
this.entity.collision.halfExtents = newHalfExtents;
What am I doing wrong? I haven’t been able to figure out if I need to call another function to force it. I have tried removing and adding the component. Thanks! Here is a build if you want to take a look: GALANO - PLAYCANVAS
Thanks a lot!!
Jordi