Jump to content
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,816
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by geckoo

  1. Just a little script which I have done to help someone recently. It allows to create, using the new UI, a smooth horizontal compass. Regarding the North pole and the player position, it computes a value between -0.5 and 0.5 - exactly what we need so as to set the sprite offset. Put it on your player, set your sprite - no more ++ 0 is the North, 0.25 is the West, -0.5/0.5 is the South, and -0.25 is the East DON'T FORGET - IMAGE WRAP MODE TO "REPEAT" using UnityEngine; using UnityEngine.UI; public class Compass : MonoBehaviour { public RawImage myCompass; void Update() { var lol = MyCompass(new Vector3(this.transform.forward.x, 0, this.transform.forward.z), Vector3.forward, Vector3.up); myCompass.uvRect = new Rect(lol, 0, 1, 1); Debug.Log(lol); } float MyCompass(Vector3 a, Vector3 b, Vector3 n) { float angle = Vector3.Angle(a, b); float sign = Mathf.Sign(Vector3.Dot(n, Vector3.Cross(a, b))); float cmp = (angle * sign)/360; return cmp; // our offset between -0.5 and 0.5 } }
  2. Because I am a good boy and tomorow will start my holidays, take this script with which you can easily create a horizontal compass. It works with the new UI. Put it on your player and set your sprite. I tested it and it works as I expected. I guess that you could add some features. I wish you the best ++ https://armedunity.com/topic/15112-horizontal-compass/
  3. Well well well. Even though the previous code was interesting, it seems to me that there is something wrong - we have two null values because it computes the perpendicular - and it's true, we can consider two perpendicular as possibilities. In consequence, I recommend you to use the next code. This way 0 is the North, 0.25 is the West, -0.5/0.5 is the South and -0.25 is the East. It could be better so as to compute our texture offset. Start your image with the North (offset 0) and the South (offset -0.5/0.5) must be the center ++ using UnityEngine; using System.Collections; public class Compass : MonoBehaviour { void Update() { Debug.Log(MyCompass(new Vector3(this.transform.forward.x, 0, this.transform.forward.z), Vector3.forward, Vector3.up)); } float MyCompass(Vector3 a, Vector3 b, Vector3 n) { float angle = Vector3.Angle(a, b); float sign = Mathf.Sign(Vector3.Dot(n, Vector3.Cross(a, b))); float cmp = (angle * sign)/360; return cmp; // our offset between -0.5 and 0.5 } }
  4. Using an infinite point (Vector3.forward) you set the North. This code gives you a value between -1 and 1 which you have to use as a texture offset. It uses the main camera. Modify it ++ using UnityEngine; using System.Collections; public class Compass : MonoBehaviour { void Update() { Vector3 p = Vector3.Cross(new Vector3(Camera.main.transform.forward.x, 0f, Camera.main.transform.forward.z), Vector3.forward); float dir = Vector3.Dot(p, Vector3.up); Debug.Log(dir); } } More information for SetTextureOffset : https://docs.unity3d.com/ScriptReference/Material.SetTextureOffset.html
  5. geckoo

    Amnesia for free

    Amnesia Collection is now available for free on Humble Bundle store. As usual, you have to download these games using your Steam account... I cannot play them - I am just afraid ++ https://www.humblebundle.com/store/amnesia-collection
  6. alpha = transparency
  7. Cool. Fellow, please, can you credit background track? These two/three chords are just unforgettable - and really hypnotic. I like it. Thanks ++
  8. geckoo

    Wow

    Amazing foliage and plants' renderer
  9. The question has been posted the 5th January. Taking a look at his user account, I noticed that he visited our forum the 6th. Since this day - nothing. Strange behavior. He asked us, but our answers don't interest him. Well well... I guess that the problem could be more important that it seems :/ Dear fellows - don't waste your time ++
  10. Interesting, but it could be more efficient to use a second camera for hand/light. They pass through walls Nice glitch FX. Thank you for sharing. I will take a look ++
  11. Or you can use ProGrid - an useful tool ++
  12. Hello друг мой. Я очень рад с тобой познакомиться. Добро пожаловать на форум. Мало членов говорят по-русски. Поэтому предпочитаю продолжать разговор на английском. I would like to give you a tip which I use in my projects. Also I have many textures sometimes to create walls, floor or boxes, etc. Often Unity users try to create all their world, displaying/scaling/setting all elements by themself. I think that they are wrong - especially when they use primitive shapes like spheres, cubes, etc. You talk about maze? It could be better to create a script which intantiates each parts in runtime - and you define all Vector3 in an array. This way, you have no problem with alligment or junction. Just a tip ... As a simple example, take a look at this script which I share here. It splits a big collider to create prefabs inside. The loop instantiates prefabs using integer coordinates. This one can create empty spaces which are defined in an array. However you can invert method easily. No problem with aligment. You could create your maze using it. Just an example ++
  13. I like colors and water effect - and especially the name Мне очень нравится то, что ты сделал. Тем не менее, я хотел бы посоветовать тебе пробовать другие комплекты шрифта. Твой - слишком обычен ++
  14. Again I would like to encourage you to take a look at the main tutorials page which have been created by Unity Team. There is many projects for beginners and some simple models. I assume that you could learn the most important here using some basic scripts for an efficient gameplay. Even though you are an absolute beginner (or not), I guess that you will appreciate their little games - Roll-A-Ball or Space Shooter. Many kids think that they can devellop a One Million Dollars Game in a few days and without any understanding. It's a trap... Don't give up and be sure that soon you will be a good dev - I wish you the best ++ https://unity3d.com/fr/learn/tutorials
  15. The same which has been ripped frop CS. This is the main problem with all these weapons and animations which are available for free - often it's a copyright infringement ++
  16. Really. I have seen this bison PP somewhere - maybe CoD or CS. Can you tell us where you found these weapons?
  17. Crouch animation could be smoother (lerp it). Have you ripped weapons from CS or CoD4?
  18. You're welcome. Show us some new updates soon. Great ++
  19. geckoo

    New update???

    I DON'T KNOW. PLEASE BE PATIENT - OR FIX THEM ++ winner
  20. It seems really interesting, even through there is many many work to do at this stage - I noticed clipping, bugs, no realistic animations and other bad thinks... However, sharing your project, the main objectif is no doubt very laudable. I wish you the best ++
  21. Recently I have installed on my PC the latest Unity version - 2017.3 and I noticed some changes which seem to me really interesting - among them, custom icon. As usual, in my latest project I created a GameManager script because I want to keep my project clean (inside it there is many functions which I use all along the project) - and automatically it uses a custom icon - a gear. Why not? I wonder if there is any other script names that get auto assigned special icons? It could be help us developing large projects ++
  22. It seems to me very usual - nothing new. However, thank you for the link ++
  23. Have I told you yet that I don't like uPlay?
  24. PS : you have less than 45 minutes to grab it for free ++
×
×
  • Create New...