eat away at gameobject

I want to be able to slowly eat away at a gameobject with the player object. I do not want to destroy the target gameObject in one fell swoop but I want the player to be erasing the target gameobject little by little.

I want the player object to have a script like this

function OnTriggerStay (other : Collider){
Erase(other.transform.position); //erase other.gameobject at specific point


maybe I need an OnCollisionStay function to gather more data about the object. I’m not sure though. I want the player to have to carve into the gameobject to the point where they can pass through. If I make the target a network of a bunch of small objects, I can see how this problem can be solved but this game is going to be on the iPhone so I don’t want it to be too cumbersome.

A simple way of solving this and still keeping a good end result regarding performance would be to use a sprite manager (or a particle system) with a shader that hides certain geometry behind it. As Kieren states - this would look far best in an orthographic perspective, or side-scrolling/top-down.

Have a look at this project made by Bob Berkebile and particularly the shader. It makes use of disabling the RGB rendering and shifts in the geometry rendering queue. You can strip out the use of alpha testing which will be far to expensive to run on a phone at the time being.

Shader "Depth Mask" {
    SubShader {
        Tags {"Queue" = "Geometry-10" }
        Lighting Off
        ZWrite On
        ColorMask 0
        Pass {}

You would create sprites with colliders where the fire is spreading, then - if game objects are to visually pass through - by using the A* algorithm for instance, let them find their way passed the colliders.