Hi play canvas team, i have a project where have a lot of simple entities(200 and more), they moving, rotating. And i notice sometimes they all freeze when run GC, for my game this is not acceptable, can you reduce places where you engine generate new objects in memory and i think GraphNode is good place for that. This code sample from you repository:
setPosition: function ()
{
// posible move to GraphNode temp variables, create once on class init,
var position = new pc.Vec3();
// posible move to GraphNode temp variables, create once on class init,
var invParentWtm = new pc.Mat4()
// generate new function(produce garbage), i think this is bad too
return function (x, y, z) {
if (x instanceof pc.Vec3) {
position.copy(x);
} else {
position.set(x, y, z);
}
if (this._parent === null) {
this.localPosition.copy(position);
} else {
invParentWtm.copy(this._parent.getWorldTransform()).invert();
invParentWtm.transformPoint(position, this.localPosition);
}
if (!this._dirtyLocal)
this._dirtify(true);
};
}
Also i see when i enable or disable rigidbody, it also generate garbage in memory, so it is not posible using Pool pattern for rigidbody, when i disable or enable entire Entity.