- Home /
Desintergrate Enemies on Dying
I'm not sure if many of you might remember the old "The Invaders" TV series but I'm wondering if a similar disintergration effect can be given to my Alien Zombies a short period after they have been killed. Just an idea I had, don't know if I'll actually use it. It would depend on how cool the effect was plus I was thinking it would be a cool way to rid my landscape of many dead Alien Zombie bodies lying about ;)
I applied this script from the Wiki to my Zombie Alien Dead replacement:
// simple "dissolving" shader by genericuser (radware.wordpress.com)
// clips materials, using an image as guidance.
// use clouds or random noise as the slice guide for best results.
Shader "Custom Shaders/Dissolving" {
Properties {
_MainTex ("Texture (RGB)", 2D) = "white" {}
_SliceGuide ("Slice Guide (RGB)", 2D) = "white" {}
_SliceAmount ("Slice Amount", Range(0.0, 1.0)) = 0.5
}
SubShader {
Tags { "RenderType" = "Opaque" }
Cull Off
CGPROGRAM
//if you're not planning on using shadows, remove "addshadow" for better performance
#pragma surface surf Lambert addshadow
struct Input {
float2 uv_MainTex;
float2 uv_SliceGuide;
float _SliceAmount;
};
sampler2D _MainTex;
sampler2D _SliceGuide;
float _SliceAmount;
void surf (Input IN, inout SurfaceOutput o) {
clip(tex2D (_SliceGuide, IN.uv_SliceGuide).rgb - _SliceAmount);
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
Fallback "Diffuse"
}
But I get this error: Assets/Misc Scripts/ZombieAlienDisolve.js(6,9): UCE0001: ';' expected. Insert a semicolon at the end.
Why? is it because this is not java script or something...?? Has anyone tried this out and if so how do I use this on one of my Alien Zombies?
Answer by efge · Mar 22, 2011 at 08:56 PM
You could use the Dissolve With Texture shader from the wiki.
Ooooh I REALLY like the way that looks. Something like this I think will work very well for my level 3 $$anonymous$$utants I've got planned. Thanks for updating and sharing that most AWESO$$anonymous$$E link :)
Answer by flaviusxvii · Mar 22, 2011 at 08:47 PM
I've done some nice "disintegration" in the past by setting the alpha values of my textures to some kind of cloudy noise, then I'd animate the alpha threshold from 1 to 0 and the object would sort of dematerialize. I even set it up so that when the alpha value was right on the cusp of the threshold the color value would switch to a bright yellow, so it look like burning paper.
^ This is the simplest yet most effective way to do it in my opinion. And if the cloudiness isn't "disintegraty" enough, you can always up the noise level a lot, and you'll get a very sharp fuzzy disappearance. All sorts of effects can be done using fading alpha. For instance, an image that starts white on top and fades to black on bottom would make the textured object slowly disappear from top to bottom when faded.
I have no use for this right now, but I'm definitely filing it away as an awesome idea for later.
Hey flaviusxvii - would it be possible to share the shader you described in your answer please? What you describe is exactly what I need to do, but my knowledge of shaders is too limited at present!
Answer by Alexandre Zakime · Mar 22, 2011 at 08:43 PM
You could try something with particles, it won't be THAT effect, but I think it would be cool.
When the enemy dies make a delay to start the particle system and making the enemy 'invisible' in mesh renderer, destroying it after.
Answer by efge · Mar 22, 2011 at 08:49 PM
You could make a mix: The already mentioned Particle System and texture manipulation and some kind of "Split Effect":
var parts = GameObject.FindGameObjectsWithTag ("Part");
for (var part in parts) {
part.AddComponent ("Rigidbody");
part.AddComponent ("SphereCollider");
part.rigidbody.AddExplosionForce (...);
}
You have to assign the tag "Part" to the meshes you want to split.
(just an idea)
WOW all of these sound really cool. Would either work for an FPS game? I probably should have mentioned that. I rather like that one mentioned by "flaviusxvii" about the burning paper sort of effect but I would make $$anonymous$$e like a glowing green somehow. I thought about particle effects. $$anonymous$$ost of my issue is the how to script something like this. $$anonymous$$y Alien Zombie have charatcer controller too if that plays a big difference?
I use my script for as a part of an explosion effect and it works :-)
Thanks efge, I suppose my other question would be, would I make my script on my character damage script or would I make something like this in their AI script, or does it make a difference?
There a many ways of doing this, one would be destroying the original enemy and instantiate a special prepared one without the charatcer controller but with the effect script attached. ($$anonymous$$aybe it's time for an upvote? :-)
I already have a dead replacement which is a rag doll of my alien zombie which does a nice Alien Squeel when he collapses. Video of him kickin it here: http://www.youtube.com/watch?v=$$anonymous$$JWZRwbxgoI But I'm wodering if I can further enhance that death by some of these cool ideas above?
Your answer
Follow this Question
Related Questions
help with UCE0001: ';' expected. Insert a semicolon at the end 3 Answers
Editing the jumppad from the 3rd person tutorial 2 Answers
Lerpz tutorial multiple errors.HELP!!!! 4 Answers
Scripting Error when drawing texture to custom window; What am I doing wrong? 1 Answer
Collision Detector script 1 Answer