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

Everything posted by geckoo

  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. 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 }
  6. 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/
  7. 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 ++
  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 ++
  16. Продолжи тратить твоё время, пренебрегая нашими советами... Великая проблема заключается в следующем - элементарные понятия ты не знаешь. Это не упрёк, а только факт. Раз и навсегда будь разумен :/ Где проблема? всё написано здесь - я проверил этот код. И как тебе объяснил OMA, не заблокируй курсор если ты хочешь двигаться : using UnityEngine; public class MyCursor : MonoBehaviour { bool _toggle; void Start() { // cursor is hidden and locked at start Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; _toggle = true; } void Update() { // it is visible - it will be invisible and locked if (Input.GetKeyDown(KeyCode.Escape) && _toggle == false) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; _toggle = true; } // it is invisible - it will be visible and unlocked else if (Input.GetKeyDown(KeyCode.Escape) && _toggle == true) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; _toggle = false; } } }
  17. Noob request. I guess that you erased your camera filters folder or you displaced them ++
  18. A little code which shows how to send a Email by a script. As an example, I use gmail. You must had an valid account - or find an anonymous SMTP server. If you know one, share with me its address ++ https://msdn.microsoft.com/fr-fr/library/system.net.mail.mailmessage(v=vs.110).aspx using UnityEngine; using System.Collections; using System; using System.Net; using System.Net.Mail; using System.Net.Security; using System.Security.Cryptography.X509Certificates; public class MailMe : MonoBehaviour { void Start() { // corpus MailMessage mail = new MailMessage(); mail.From = new MailAddress("jojo@gmail.com"); // sender mail.To.Add("jojo@gmail.com"); // receiver mail.Subject = "Hello"; // header mail.Body = "it is just another boring saturday night :)"; // your message SmtpClient smtpServer = new SmtpClient("smtp.gmail.com"); // gmail SMTP smtpServer.Port = 587; // used port for gmail SMTP with SSL // your valid account informations smtpServer.Credentials = new System.Net.NetworkCredential("jojo@gmail.com", "password") as ICredentialsByHost; smtpServer.EnableSsl = true; // SSL option // check relation between sender and SMTP ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; // send mail smtpServer.Send(mail); Debug.Log("success"); // done } }
  19. Thank you nice work ++
  20. Привет друг мой. Будь уверен, что я не хочу к тебе проявлять неуважение. Тем не менее, сталкиваясь с этой простой проблемой, я думаю, что тебе придется начать проще. Очевидно, читая твои разные комментарии, есть доказательство того, что у тебе нет опыта. Будь мудр! и попробуй понять самое главное - то есть основy. Не спеши! Зачем утратить времени с каким-то проектом, который на самом деле ты не сможешь понять, когда всё доступно здесь и на русском языке? https://unity3d.com/ru/learn Тебе желаю успехов. Никогда не сдавайся!
  21. Just a little word to say that you can download for free (or pay-what-you-want) an interesting puzzle game which has been developed by a French IndieDev - NuSan. This is a fun project for those who like burn theirs neurons, enjoying weird experience - something between Antichamber and Portal. The first release has been developed during the last LudumDare session. Objectively this game is just amazing with a good aesthetic and a strange atmosphere. Since Portal, I have never seen anything in my gamer life that is so good and so clever. Even if you don't like this genre, take a look at the video which is really explicit, showing the main gameplay. Have fun ++ https://nusan.itch.io/fragments-of-euclid
  22. They said on Asset Store (maybe you didn't read that) : *SMK IS NO LONGER MAINTAINED, AS UNITY 5.1 ONWARDS DOES NOT USE RAKNET, BUT INSTEAD UTILIZES A MUCH SIMPLER NETWORKING SYSTEM. IF YOU AREN'T ALREADY WORKING WITH SMK, OR ARE USING UNITY 5, DON'T BOTHER WITH THIS ASSET - USE THE NEWER UNET SYSTEM. For me all is clear ++
  23. I think that your HDD is dying, but you can try to repair it using CHKDSK, but don't hope anything at all - the process has begun and its death is pending... Be careful, with CHKDSK because this command is really powerful - and you can damage your data. However, delivering more information about problems, it would allow you a stability in order to save what you can. Good luck ++ https://technet.microsoft.com/en-us/library/cc730714(v=ws.10).aspx
  24. Hello! I am trying to do a good video about one of my latest projects - a game which is inspired by my entry for the LudumDare event. I tested many free applications including the tool which is embedded in Windows10, Microsoft Encoder Expression, WebLaunchRecorder, Fraps and more. At last, after many attemps, the best tool is (without any doubt) OBS - it works fine and its interface is intuitive with many features and options. However, in each case, I noticed a big problem with the black color - and my game is particularly dark. For a game with a static camera, the render is perfect, but when camera is moving, I have a jelly on screen - something which is just ugly. Do you know a decent tool (free or not too expensive) with which I could do a video, even for a darkly game? Thank you for your help ++