I’m just playin around with a project …
basically I want to update a model with damaged version of the model …
I’ve totally gone blank can anyone point me in the right direction …
thanx
here’s a link to the project for the curious
http://www.az.suiteaz.com/php_scripts/views/?action=gameselect&id=2
Destroy the old mesh and replace it with a new one? (additionally a sequence of damaged models)
Replace the texture on the mesh to a damaged variation?
Those are the common methods.
I was thinking destroy the old mesh and replace it with a new one.
Vicenti
September 10, 2010, 3:15pm
4
object.mesh = aDifferentMeshYouKnowAboutSomehow;
or
object.normalMesh.active = false;
object.damageMesh1.active = true;
that aught to sort me out … thanx Vicenti
that workx a treat
here’s a sample of the code
function damageMesh(damageLevel) {
print(Vector2(myPartInt, damageLevel));
if (damageLevel == 1) {
meshOrig = GetComponent(MeshFilter).mesh;
meshOrig.vertices = meshDamaged1.vertices;
meshOrig.normals = meshDamaged1.normals;
meshOrig.triangles = meshDamaged1.triangles;
meshOrig.uv = meshDamaged1.uv;
} else if (damageLevel == 2) {
meshOrig = GetComponent(MeshFilter).mesh;
meshOrig.vertices = meshDamaged2.vertices;
meshOrig.normals = meshDamaged2.normals;
meshOrig.triangles = meshDamaged2.triangles;
meshOrig.uv = meshDamaged2.uv;
}
}
I found that if I didn’t reassign tri’s, norm, verts and uv’s that it was a kinda messy result with new norms etc being mapped the old positions
anyway cheers for that, it was exactly what I was looking for
here’s a sample of the project with damage mesh’s
http://www.az.suiteaz.com/php_scripts/views/?action=gameselect&id=2
still working on some mesh’s but you get the idea …
thanx again