fix parent mesh in linking
parent
01fbf4e2ae
commit
9e038c3247
|
@ -354,6 +354,16 @@ GameLib.D3.Mesh.prototype.applyBones = function(geometry) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Mesh.prototype.setParentMesh = function(parentMesh) {
|
||||||
|
|
||||||
|
this.parentMesh = parentMesh;
|
||||||
|
|
||||||
|
if (parentMesh && parentMesh.loaded) {
|
||||||
|
this.instance.parent = this.parentMesh.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
GameLib.D3.Mesh.prototype.createInstanceDefaults = function(instance) {
|
GameLib.D3.Mesh.prototype.createInstanceDefaults = function(instance) {
|
||||||
|
|
||||||
instance.name = this.name;
|
instance.name = this.name;
|
||||||
|
|
|
@ -307,6 +307,28 @@ GameLib.System.Linking.prototype.meshInstanceCreated = function(data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var meshes = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Mesh);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link Parent Meshes
|
||||||
|
*/
|
||||||
|
meshes.map(
|
||||||
|
function(mesh) {
|
||||||
|
|
||||||
|
if (mesh === data.mesh) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mesh.parentMesh === data.mesh.id) {
|
||||||
|
mesh.setParentMesh(data.mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.mesh.parentMesh === mesh.id) {
|
||||||
|
data.mesh.setParentMesh(mesh);
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.System.Linking.prototype.lightInstanceCreated = function(data) {
|
GameLib.System.Linking.prototype.lightInstanceCreated = function(data) {
|
||||||
|
|
Loading…
Reference in New Issue