This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

geckoo

Moderators
  • Content count

    2,195
  • Joined

  • Last visited

  • Days Won

    57

geckoo last won the day on February 28

geckoo had the most liked content!

Community Reputation

516 Excellent

About geckoo

  • Rank
    Суета сует и погоня за ветром
  • Birthday

Profile Information

  • Gender
    Male
  • Location:
    - между раем и адом

Recent Profile Visitors

1,543 profile views
  1. Nice attempt but you did better
  2. 3 years old? It seems to me that this is a record here no?
  3. Thank you OcularCash for your answer - and the explanation. I don't understand Vector3.Dot because even after many alternatives, I have always the same result. I changed my code for another function which works as expected. it allows to know exactly each position - one over the other : bool isBehind(GameObject ply) { var sum = Mathf.DeltaAngle(ply.transform.rotation.eulerAngles.y, this.transform.rotation.eulerAngles.y); if (sum > -45.0f && sum < 45.0f) // a large cone behind the player return true; else return false; } If sum is ranged between -135 and 135, it means that the transform is toward its target, If sum is ranged between -45 and 45, it means that the transform is behind its target, If sum is ranged between -135 and -90, it means that the transform is at right of its target, If sum is ranged between 135 and 90, it means that the transform is at left of its target.
  4. Hi friends. I am trying desperately to understand Vector3.Dot in order to check if an enemy hits the player from behind. I read the explanation which has been written by Unity, but something is still unintelligible. I have always the same value - face to enemy and turn back. Maybe I did a mistake? Thank you for your help ++ https://docs.unity3d.com/ScriptReference/Vector3.Dot.html bool isBehind(GameObject ply) { Vector3 forward = this.transform.TransformDirection(Vector3.forward); Vector3 toOther = ply.transform.position - this.transform.position; // this script is attached on my enemy // we look in the same direction - so it hits me from behind no? if (Vector3.Dot(forward, toOther) > 0.0f) return true; else return false; }
  5. Hi fellows. You should add Chivalry: Medieval Warfare to your Steam account and play for free. This offer starts today - until March 28th at 10AM Pacific Time. However, once you add the game it will remain in your account after the free period. So don't miss out on this opportunity to play this first-person multiplayer slasher which has a good rate... A game for free ++ http://store.steampowered.com/news/28406/
  6. Probably one of the most beautiful and interesting projects which I have ever seen under Unity... Now I remember my scepticism and you finally convinced me. Really good work - except some animations which could be better ++
  7. I am very proud of this shader which creates a neat toon effect. The renderer is good and many features are configurable. Have fun ++ http://hpics.li/98d9513 Script C# using UnityEngine; [ExecuteInEditMode] [RequireComponent (typeof(Camera))] public class Toon : MonoBehaviour { [Range(0.1f, 1.0f)] public float _strength = 0.5f; [Range(2, 10)] public int _posterization = 4; [Range(0.01f, 1.0f)] public float _global = 0.2f; public bool _grayscale; Camera cam; private Shader toonShader = null; private Material toonMaterial = null; bool isSupported = true; void Start() { CheckResources(); } public bool CheckResources () { toonShader = Shader.Find ("MyShaders/Toon"); toonMaterial = CheckShader(toonShader, toonMaterial); return isSupported; } protected Material CheckShader(Shader s, Material m) { if (s == null) { Debug.Log("Missing shader in " + ToString()); this.enabled = false; return null; } if (s.isSupported == false) { Debug.Log("The shader " + s.ToString() + " is not supported on this platform"); this.enabled = false; return null; } cam = GetComponent<Camera>(); cam.renderingPath = RenderingPath.UsePlayerSettings; m = new Material(s); m.hideFlags = HideFlags.DontSave; if (s.isSupported && m && m.shader == s) return m; return m; } void OnDestroy() { #if UNITY_EDITOR DestroyImmediate(toonMaterial); #else Destroy(toonMaterial); #endif } void OnRenderImage (RenderTexture source, RenderTexture destination) { if (CheckResources() == false) { Graphics.Blit (source, destination); return; } toonMaterial.SetFloat("_strength", 1 - _strength); toonMaterial.SetInt("_poster", _posterization); toonMaterial.SetFloat("_global", 1 - _global); if (_grayscale == true) toonMaterial.EnableKeyword("GRAYSCALE"); else toonMaterial.DisableKeyword("GRAYSCALE"); Graphics.Blit (source, destination, toonMaterial); } } Shader Shader "MyShaders/Toon" { Properties { _MainTex("MainTex", 2D) = "white" {} _size("Size", int) = 512 _strength("Strength FX", float) = 0.5 _poster("Posterization", int) = 4 _global("Global Illumination", float) = 0.8 } CGINCLUDE #include "UnityCG.cginc" sampler2D _MainTex; float4 _MainTex_ST; int _size; float _strength; int _poster; float _global; struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; }; v2f vert(appdata_full v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } float4 frag(v2f i) :COLOR { float3 lum = float3(0.2125, 0.7154, 0.0721); float o00 = dot(tex2D(_MainTex, i.uv - float2(1, 1) / _size).rgb, lum); float o10 = dot(tex2D(_MainTex, i.uv - float2(0, 1) / _size).rgb, lum); float o20 = dot(tex2D(_MainTex, i.uv - float2(-1, 1) / _size).rgb, lum); float o01 = dot(tex2D(_MainTex, i.uv - float2(1, 0) / _size).rgb, lum); float o11 = dot(tex2D(_MainTex, i.uv).rgb, lum); // float o21 = dot(tex2D(_MainTex, i.uv - float2(-1, 0) / _size).rgb, lum); float o02 = dot(tex2D(_MainTex, i.uv - float2(1, -1) / _size).rgb, lum); float o12 = dot(tex2D(_MainTex, i.uv - float2(0, -1) / _size).rgb, lum); float o22 = dot(tex2D(_MainTex, i.uv - float2(-1, -1) / _size).rgb, lum); float GX = -1 * o00 + o20 + -2 * o01 + 2 * o21 - o02 + o22; float GY = o00 + 2 * o10 + o20 - o02 - 2 * o12 - o22; float G = abs(GX) + abs(GY); float4 c = 0; c = length(float2(GX, GY)); float4 sum = tex2D(_MainTex, i.uv); sum *= _poster; sum = floor(sum); sum /= _poster; sum = pow(sum, _global); #ifdef GRAYSCALE sum = dot(float3(0.33, 0.33, 0.33), sum.rgb); #endif if (c.x < _strength) return sum; else { float4 c0, c1, c2, c3 = (float4)0; c0 = tex2D(_MainTex, i.uv + float2(0.5, 1) / _size); c1 = tex2D(_MainTex, i.uv + float2(-0.5, 1) / _size); c2 = tex2D(_MainTex, i.uv + float2(0.5, -1) / _size); c3 = tex2D(_MainTex, i.uv + float2(-0.5, -1) / _size); sum = (sum * (c0 + c1 + c2 + c3)) * 0.01; return fixed4(sum); } } ENDCG Subshader { Pass { ZTest Always Cull Off ZWrite Off CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma shader_feature GRAYSCALE ENDCG } } Fallback off }
  8. This script allows to display a big noise on screen so as to simultate a bad transmission. Also there is a little jitter. It reminds those effect which often we see in projects like Slender - when it appears. You can change many features. Have fun ++ Script C# using UnityEngine; [ExecuteInEditMode] [RequireComponent (typeof(Camera))] public class BigNoise : MonoBehaviour { public enum myFX { Add, Subtract, Divide, Multiple }; public myFX _effect; int _fx = 0; [Range(-5.0f, 5.0f)] public float _frequency = 2.0f; [Range(-5.0f, 5.0f)] public float _contrast = 2.0f; [Range(1.0f, 5.0f)] public float _size = 2.0f; [Range(0.0f, 1.0f)] public float _dispersal = 0.25f; Camera cam; private Shader bigNoiseShader = null; private Material bigNoiseMaterial = null; bool isSupported = true; void Start() { CheckResources(); } public bool CheckResources() { bigNoiseShader = Shader.Find("MyShaders/BigNoise"); bigNoiseMaterial = CheckShader(bigNoiseShader, bigNoiseMaterial); return isSupported; } protected Material CheckShader(Shader s, Material m) { if (s == null) { Debug.Log("Missing shader on " + ToString()); this.enabled = false; return null; } if (s.isSupported == false) { Debug.Log("The shader " + s.ToString() + " is not supported on this platform"); this.enabled = false; return null; } cam = GetComponent<Camera>(); cam.renderingPath = RenderingPath.UsePlayerSettings; m = new Material(s); m.hideFlags = HideFlags.DontSave; if (s.isSupported && m && m.shader == s) return m; return m; } void OnDestroy() { #if UNITY_EDITOR DestroyImmediate(bigNoiseMaterial); #else Destroy(bigNoiseMaterial); #endif } void OnRenderImage (RenderTexture source, RenderTexture destination) { if (CheckResources() == false) { Graphics.Blit (source, destination); return; } if (_effect == myFX.Add) _fx = 0; if (_effect == myFX.Subtract) _fx = 1; if (_effect == myFX.Divide) _fx = 2; if (_effect == myFX.Multiple) _fx = 3; float _f = _frequency; float _c = _contrast; _f += Mathf.Sin(Time.time * 10) * _dispersal; _c -= Mathf.Sin(Time.time * 50) * _dispersal; bigNoiseMaterial.SetInt("_effect", _fx); bigNoiseMaterial.SetFloat("_frequency", _f); bigNoiseMaterial.SetFloat("_contrast", _c); bigNoiseMaterial.SetFloat("_size", _size); bigNoiseMaterial.SetFloat("_dispersal", _dispersal); Graphics.Blit (source, destination, bigNoiseMaterial); } } Shader Shader "MyShaders/BigNoise" { Properties { _MainTex("Base (RGB)", 2D) = "white" {} _effect("Effect", int) = 0 _frequency("Frequency", float) = 2 _contrast("Contrast", float) = 2 _size("Parasite Size", float) = 2 _dispersal("Dispersion Force", float) = 0.25 } CGINCLUDE #include "UnityCG.cginc" uniform sampler2D _MainTex; int _effect; float _frequency; float _contrast; float _size; float _dispersal; struct v2f { float4 position : SV_POSITION; float2 uv : TEXCOORD0; }; float rand(float3 co) { return frac(sin(dot(co.xyz ,float3(13.1, 78.2, 45.5))) * 50000); } float4 frag(v2f i) : SV_Target { float dx = 1 - abs(distance(i.uv.x, _frequency)); float dy = 1 - abs(distance(i.uv.y, _contrast)); dy = ((int)(dy * 8)) / 8.0; i.uv.y += dy * 0.025 + rand(float3(dy, dy, dy)).r / 500; i.uv.x += dx * 0.025 + rand(float3(dx, dx, dx)).r / 500; i.uv.x = i.uv.x % 1; i.uv.y = i.uv.y % 1; fixed4 sum = tex2D(_MainTex, i.uv); float x = ((int)(i.uv.x * 320 / _size)) / 320.0 / _size; float y = ((int)(i.uv.y * 240 / _size)) / 240.0 / _size; if (_effect == 0) sum += rand(float3(x, y, _frequency)) * _contrast / 5; if (_effect == 1) sum -= rand(float3(x, y, _frequency)) * _contrast / 5; if (_effect == 2) sum /= rand(float3(x, y, _frequency)) * _contrast / 5; if (_effect == 3) sum *= rand(float3(x, y, _frequency)) * _contrast / 5; return fixed4(sum); } ENDCG SubShader { Pass { ZTest Always Cull Off ZWrite Off Fog{ Mode off } CGPROGRAM #pragma vertex vert_img #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest ENDCG } } }
  9. Merry Xmas and happy new year
  10. Neat. Have you did by yourself those weapons and arms? I like them ++
  11. Here you can find some scripts which could be useful : http://wiki.unity3d.com/index.php?title=FadeInOut I use in my project the script which has been developed by Kentyman - the third. It seems to me that it is the best... You must set the initial color and then call the function so as to start th FX : SetScreenOverlayColor(new Color(0,0,0,1)); // black opaque StartFade(new Color(1,0,0,1), 5); // to red opaque - 5 seconds As said omard2000, you should use a coroutine in order to wait a while before you load the new scene ++
  12. There is a toon effect which gives at this model a toy aspect, but I like that ++
  13. I assume that you didn't understand the main rule here. No one wants write something until you did a first attempt. You talk about randomization - this is a first idea which you could experiment. Try to use NavMeshAgent - and (more or less) obviously all is done ++
  14. Maybe because it has been edited almost 3 years ago? However I assume that it could be created again without any difficulty using new Canvas (world space). There is a good tutorial here :
  15. showcase

    nice cars ++