Hi all,
Have been searching around for ages but struggling to add a material to an object when a collision occurs - like a bullet hole on a wall. For the projectile I have this
var splatMat:Material;
function OnCollisionEnter (collisionInfo : Collision) {
// Rotate the object so that the y-axis faces along the normal of the surface
var contact : ContactPoint = collisionInfo.contacts[0];
var rot : Quaternion = Quaternion.FromToRotation(-Vector3.right, contact.normal);
var pos : Vector3 = contact.point;
var mats=collisionInfo.gameObject.renderer.materials;
/* Question here *****/
//how do I add my splatMat to the materials object on the collisionInfo.gameObject?
// Destroy the projectile
Destroy (gameObject);
}
thanks in advance
Are you looking to purchase the easy save asset on the asset store? If so: https://www.assetstore.unity3d.com/en/#!/content/768
– rustofeleesAlso, for what it's worth. This post is almost 2 years old. I've since started using this asset which has worked out really well: https://www.assetstore.unity3d.com/en/#!/content/36879
– rustofelees