playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF

Home Page:https://playcanvas.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mesh collider no longer scales in real time

Latenos opened this issue · comments

Description

I have been unable to update the mesh collider scale since around March of this year.

I have prepared a minimal project on this issue, please see
https://playcanvas.com/project/1204845/overview/meshcolliderscaletest

This project has 4 spheres in a box.
A tween changes the size of the box.
I want to smoothly scale the mesh collider to match the scale of that box.
If I can correctly scale the mesh collider, the movement of the spheres should change.

I suspect the reason is that the following code in realtimeScaling.js is not working for some reason.
col.system.implementations.mesh.doRecreatePhysicalShape(col);

Previously, in order to resize the mesh collider in real time, the above code could be called every frame to do the update.
However, one day it stopped working.
I understand that this is a very costly process, but I really need this.

I have been developing a project that uses this program for a long time and it did not work on previous projects either.

Any help would be much appreciated.
Thank you very much.

Yeah this really needs some solution, there are multiple issues created for this, for example #3062

As a workaround, you could considering clearing the _triMeshCache mentioned here: #4181

That might let you re-create the scaled collider correctly. Not a proper solution, but maybe something to get you going till this is fixed.