How could i make my character invisable - but allow my player to still be damaged

I basically would like a refrence to something that would allow me hide my player model in third person but still allow a bullets to damage my player.

For example objectIsInvisable?


You could alter this via the renderer, if you put something similar to this on your character:

var thirdPersonCamera : Camera;
function Update() {
if(thirdPersonCamera.enabled)renderer.enabled = false;
}

The object will still remain visible to rays, collisions and such, just hidden from the camera.

To check if the object is visible you could use:

static var playerIsVisible = true;
var playerObject : Transform;
function Update() {
if(playerObject.renderer.enabled){
playerIsVisible = true;
} else {
playerIsVisible = false;
}

Then via another script access this via thisScript.playerIsVisible

Does this answer your question or were you after something different?

You just disable renderer to be invisible and enable it to be visible again. The character still exist except it is not displayed.

this.gameObject.renderer.enabled=false;

this.gameObject.renderer.enabled=true;