Using the script below I’m able to shoot my “laser” at group of meshes, and each one turns red. Everything works perfectly
Each laser shot is one of six random colors (that information is on a different script attached to the “gun”). My goal is to have the mesh that collides with the laser shot change in into the same material as the laser shot. So when a laser shoots out with a green material, the collided mesh turns green, when a laser with a blue material shoots out the mesh assumes the same blue material and so on. I’m totally stumped on where to start with this. If anyone has any ideas please feel free to share ![]()
#pragma strict
function OnCollisionEnter(collision : Collision)
{
for (var contact : ContactPoint in collision.contacts)
{
}
if (collision)
renderer.material.color = Color.red;
}