Search Unity

3D Radar UI : Beta-2d July-22-2016

Discussion in 'Assets and Asset Store' started by ForceX, Feb 23, 2011.

  1. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    Hi!
    May be this does not belong here but, how can I make a label with the range of the radar near to it?
     
    Last edited: Dec 16, 2015
  2. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    I don't have access to Unity ATM so look at the FX_3DRadar_Mgr inspector "Scripting Refrence" located under the field where you enter the radar range. There you can find the variable name & type. I think it's just RadarRange. Then create a new UI text and point it to the radar range variable and convert it to a string.
     
  3. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    This weekend I'll add some fields for UI Text elements to display Radar range, Radar zoom level, Target name, & Target distance.

    The way it will work is if a UI Text element has been assigned to one of the above then it will automatically update the text to show the current info. They will be optional so it will not be required for the fields to be assigned.

    This will prevent the need for external scripts to display target or radar info. Just create a UI Text, place and style how you like, and link it to the radar inspector. The one exemption to this is Target status bars are required to be updated through your own health scripts as the radar has no knowledge of this, but I might have an idea to link health data from an external script to the radar so it knows where to pull the health data from with out any special scripting required on the developer side. We will see :)
     
    runningbird likes this.
  4. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Update ForceX 3D Radar UI Beta-2a Unity 5.3.0f4

    New Features:
    1. (Beta 2a) Added the ability to assign UI Text elements for information display regarding Radar range and the selected Target info. Assignable fields can be found FX_3DRadar_Mgr --> HUD Display Settings --> HUD Info Display (UI Text)
    2.
    (Beta 2b) Added UI Text element for Sub Component Targeting.

    Fixes:
    1.
    (Beta 2b) Fixed Sub Component Tag name check when selecting sub components with the keyboard.

    Notes:
    Target status bars will need to be driven from external health scripts. No good automatic way of doing this through the radar with out moving health into the RID scripts.
     
    Last edited: Dec 21, 2015
  5. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    Hi!! I hope you can help me (If not, can you tell where to ask please!!), I'm trying to make a circle that changes its size with some keys, I used a quad like you did with the pointer and I change the size using scale, however when it gets a little small the circle disappears. ebl1.png ebl2.png ebl3.png

    How can I fix i?? or, is there another way to do what I want? I need to see the circle like in the forst image but in every size.
     
    Last edited: Dec 28, 2015
  6. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Unfortunately scaling is not going to provide you the result you are looking for. When you scale yes the circle becomes smaller but so does the width of you texture lines and at some point they will become to thin to see.

    Where i would start is,
    1. Look at the Radar_Pulse.PSD file and modify the Alpha channel so the line is solid (not a ramp texture) and change it to be a dashed line like you want. Then save this to a new file.
    2. Use a new instance of the Radar_Pulse.FBX mesh and apply your texture to it. Use the Radar_Pulse.FBX mesh because it uses special UV where the UV.x is the radius of the mesh.
    3. When ever you change the zoom level modify the materials UV.x to the value you need. The UV.x will radiate the line circle outward or inward. Do not worry about the UV.y
    • Example of changing the UV value. MyMaterial.mainTextureOffset = new Vector2(MyValue, 0);
    Another option would be to use a custom line renderer to draw a circle and change it's diameter when the zoom level changes.
     
  7. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    Thanks for the help!! :) Sorry for this question :oops: but how can I edit the psd file? I tried to change the color but I couldn't. (I'm using photoshop and/or GIMP)
     
  8. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    The .PSD file RGB should stay white. Control the color through your materials Tint Color. This way you can make it any color you want with out needing to create a bunch of other textures. The Radar Pulse texture is designed to use the Particles/Additive material, so you will need to use this as well.

    Remember to only edit the Alpha channel of the PSD as this is where the look of the texture is stored. The RGB is solid white for pixel sampling and should not be changed.
     
  9. Black-pearl

    Black-pearl

    Joined:
    Mar 20, 2014
    Posts:
    55
    Hey guys,

    This asset is fantastic I stumbled across while building a 3D radar thank you for putting this on here, only thing is I have two problems, 1 is everything is set as asked in the setup but I get a null reference exception to do with the TSI and TSI2 I have them loaded in the inspector but I can't seem to clear this and also my scene load time has more than doubled is this a normal thing for this package?

    Cheers m
     
  10. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    @ForceX Thank you so much!!! It worked!!! :):D.
     
  11. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    No, you should not have any errors. Can you post the console error? Load times from pressing play should only be about 1 sec.

    Can you load one of the provided demos and see if you still get the same error.

    Fantastic :)
     
  12. Black-pearl

    Black-pearl

    Joined:
    Mar 20, 2014
    Posts:
    55
    Yeah it's strange I loaded the demo asset and that's fine so I have been trying to copy the inspector setup into my own scene and I still can't get rid of the exception I will post you the console error in an hour or so, but basically the null exception is in the late update of the radar script and comes when it's trying to do the disable tsi2 and can't do it because of the exception.

    Hope this is a better explain action
     
  13. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    I think i might know what the issue is. Look at the FX_3DRadar_Mgr -->HUD Display Settings --> Target Selection Indicator and make sure that the Target Indicator Field is set to use the TSI Group and not the TSI.
    TSI.jpg
     
    Last edited: Jan 5, 2016
  14. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    Hi!! Me again :oops:, How can I know the distance that represents my dashed circle??? I know that it has to do with the range but how can I calculate it??
     
  15. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Try Radar Range * UV.x value of your line. That is if you are using the UV offset method which has a value of 0-1.
     
  16. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    Yes, of course,how could I forgot that. Hahaha. Thank you!!
     
  17. Black-pearl

    Black-pearl

    Joined:
    Mar 20, 2014
    Posts:
    55
    Hey guys,

    Has anyone had the problem when importing into your own scene that the offscreen indicator and target indicator works ok, but when the indicator goes onto the radar it is being instantiated at -172490, -20048, 0?

    Strange issue and the demo scene is ok

    Cheers
     
  18. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Can you link an image showing the issue?
     
  19. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    This is the only thing I can think of with out looking at your project.

    Check to make sure that the _GameMgr & Radar group are at World 0,0,0.

    The _GameMgr and Radar group need to stay at World 0,0,0

    If not then things break. If you are using a floating origin the you will need to make sure that the _GameMgr is ignored when you re position objects relative to the player.

    Radar.jpg


    Edit
    Sorry I though I had the part about keeping the _GameMgr fixed at world 0,0,0 in the Setup file. I've added it now (Beta 2c).
     
    Last edited: Jan 7, 2016
  20. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    Is there a way in which the radar forward looks differently than the players forward?? For example, that the radar pointer stays static and the "radar" rotates like another view option "always seeing to that point" intead of "always seeing my front view". I hope you understand my question :oops:. And thank you in advance
     
  21. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    ATM no, this would require a bunch of new code.
     
  22. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    Oh, that's sad. Thank you!.
     
  23. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    I am slowly working on a world space option for the radar instead of drawing directly to the screen. After this has been completed then it should be possible to use a modified version of the world space code to accomplish what you are looking for. This will still be a ways off, I'm not in hard core coding mode right now.
     
  24. Minos32

    Minos32

    Joined:
    Jun 22, 2015
    Posts:
    24
    I know, I know. I was asking because I saw an old radar simulation that make what I asked you.but is less powerful than yours. This is the code of the radar.
     

    Attached Files:

  25. Black-pearl

    Black-pearl

    Joined:
    Mar 20, 2014
    Posts:
    55
    Hey Guys,

    Me again :) all good with the radar and I don't know if its a bug or something that I am doing wrong, but basically I have figured out that I have to have the Floating Origin script attached for my game world to work correctly. Now when the radar item goes off screen then it automatically moves it to the center not the outside. Is there a change I need to do to the radar to allow for the floating origin? If i disable the floating origin script it all works ok, when I googled it I saw you had some probs with this @ForceX

    Cheers M.

    Edit - Actually the whole radar breaks with this script it doesn't show the locations of targets but the hud boxes still show around the targets
     
    Last edited: Jan 16, 2016
  26. Black-pearl

    Black-pearl

    Joined:
    Mar 20, 2014
    Posts:
    55
    Nevermind I read up and ignored it on the floating origin works great now
     
  27. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Exactly right, make sure any time you perform a "World Shift" via a floating origins script that the _GameMgr GameObject is ignored and stays at World Space 0,0,0. This is because all calculations are based around 0,0,0 and this is where the targets RID Icons, VDI, VDI Base Icon are drawn between -1,-1,-1 to 1,1,1. So moving the _GameMgr which moves the Radar object will make it look as though the RID Icons are sliding outside the Radar. Calculations are normalized to prevent floating point errors of targets that can cause jittering of the targets RID Icon on the radar.
     
    Black-pearl likes this.
  28. MajorParts

    MajorParts

    Joined:
    Sep 27, 2014
    Posts:
    88
    I just came back to this again from scratch...what does this mean....

    Assets/FX 3D Radar/Scripts/FX_3DRadar_Mgr.cs(1598,19): error CS1061: Type `UnityEngine.UI.Image' does not contain a definition for `raycastTarget' and no extension method `raycastTarget' of type `UnityEngine.UI.Image' could be found (are you missing a using directive or an assembly reference?)

    None of the scripts will load until I know what that is
     
  29. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Check your unity version "Image.raycastTarget" is a setting of the new UI Image component.

    http://docs.unity3d.com/ScriptReference/UI.Image.html

    I don't know when raycstTarget was introduced but it has been working since at least 5.0.

    Does this problem happen in the included demos?
     
  30. MajorParts

    MajorParts

    Joined:
    Sep 27, 2014
    Posts:
    88
    yeah, all scenes have the error and no scripts loaded into objects. My version is 5.1.3
     
  31. MajorParts

    MajorParts

    Joined:
    Sep 27, 2014
    Posts:
    88
    Just downloaded 5.3.2 and I see the Raycast Target option in Image components now. that wasn't there with 5.1.0 I'll re-import the radar stuff tomorrow.
     
  32. Szeiner

    Szeiner

    Joined:
    Nov 2, 2013
    Posts:
    44
    It looks the radar doesn't work correctly... My pc freezes when the radar catches more than 15 objects. Then I must reset my pc... Any solution?
     
  33. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Sorry for the late reply. I'm not sure what the issue would be. I run 100+ test all the time. Have you tried the included Stress 120 demo to see if you get the same result? Which version of Unity are you running?
     
  34. mikedolan03

    mikedolan03

    Joined:
    Oct 28, 2013
    Posts:
    14
    Hi my radar stopped working - possibly because I upgraded to the latest Unity Beta or just I messed something up. I did a blank project with just the radar package tho to check if i did something really wrong, but the demo seems to be having some issues too. one thing I noticed was a missing script even from a fresh reinstall on a fresh project - could be unity wont unpack it? anyone tell me what the script is that I am missing on the Target_1 prefab? (i think that might help explain some things as none of my targets are showing on my radar sphere anymore...) Thank you!!! (ps- a love this package- best radar around - kinda hacked it a bunch so hoping I don't have to reinstall it from scratch.)
     
  35. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    @mikedolan03 : Don't worry about the missing script on the Demos Target objects. I probably had some script attached while messing around before uploading that package. The only script that should be attached to the Demo Target objects that matters is the FX_3DRadar_RID.cs script. Any other scripts missing or otherwise are safe to remove.

    Remember if you are setting the radar up in a new project to go through the process in the Setup Text Document or things wont work. You will need to setup your layers & tags and assign them to the appropriate sections on the Radar Manager script.

    Edit:

    I just downloaded 5.4.0f2, downloaded the Package from the front page, created a new project, created the necessary Layers, Tags & assigned them to the Radar Mgr. Removed the missing scripts on the Target Objects & every thing appears to run fine.
     
    Last edited: Jul 23, 2016
  36. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Update ForceX 3D Radar UI Beta-2d Unity 5.4.0f2

    Fixes:
    1.
    (Beta 2d) Removed missing scripts from Target Objects in the Radar demo scene.
     
  37. mikedolan03

    mikedolan03

    Joined:
    Oct 28, 2013
    Posts:
    14
    Thanks! Yeah, I am not sure what is happening. My game is pretty complex at this point with lots of layers and tags and I've added my own hooks into your code to make it play with my AI etc. I think I've isolated the problem to using the render to texture and for some reason none of the objects will show up in the radar sphere. (the radar sphere shows up but know blips). Perhaps the blips are being generated on a layer that isnt being picked up by the radar sphere or arent in the camera's view or something. When i switch to one of the set positions instead or rendering to a texture everything works fine --which is what I will do for now - although I feel like I have better positioning control with the render-to-texture...
     
  38. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Ahh the issue is with the Render To Texture. I am seeing an issue with this.. Looks like something may have changed with the anchoring works in one of the 5.4 releases. I'll look into this.
     
    mikedolan03 likes this.
  39. mikedolan03

    mikedolan03

    Joined:
    Oct 28, 2013
    Posts:
    14
    awesome! yeah seems like Unity broke it for you. i will let you know if i see anything else pop up. thanks for continuing to work on this!! its really super well done. Here is a shot of my use in action-using another asset's graphics...
     
  40. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Awesome, thanks for posting a pic of your work & nice job customizing the look of the radar.

    I'll try and have a fix up by the end of the week.

    I'll also pose the changed code so you can just replace the section of code with out having to re-add your custom code. Code!!
     
    mikedolan03 likes this.
  41. mikedolan03

    mikedolan03

    Joined:
    Oct 28, 2013
    Posts:
    14
    Thank you! posting the code fix would be awesome!!!
     
  42. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Update ForceX 3D Radar UI Beta-2e Unity 5.4.0f2

    Fixes:
    1.
    Fixes for Unity 5.4 RectTransform changes.

    The issue was unity changed RectTransform.anchoredPosition to a Vector2 from a Vector3 but added a RectTransform.anchoredPosition3D to take the place of the Vector3 & there were some inheritance issues that required a forced value change with UI elements when they get created.

    Hot Fix Instructions

    1. Edit both the FX_3DRadar_Mgr.cs & FX_3DRadar_RID.cs replace all .anchoredPosition with
    .anchoredPosition3D


    2. FX_3DRadar_Mgr.cs in the Start() method replace all code under //Create The HUD Elements

    Code (CSharp):
    1.        
    2.  
    3. //Create The HUD Elements
    4.    
    5.         CreateHUD ();
    6.    
    7.         if(RadarPos == _radarPos.RenderToTexture){
    8.             Canvas C = new GameObject ("RadarRTTC").AddComponent<Canvas>();
    9.             C.renderMode = RenderMode.ScreenSpaceCamera;
    10.             C.worldCamera = RadarCamera;
    11.             C.gameObject.layer = RadarLayer;
    12.             C.planeDistance = 0.5f;
    13.             C.pixelPerfect = true;
    14.             C.GetComponent<RectTransform> ().SetParent (GameObject.Find("_GameMgr").GetComponent<Transform>());
    15.    
    16.             RectTransform RTC = GameObject.Find ("RadarTargets").GetComponent<RectTransform> ();
    17.             RTC.SetParent(C.GetComponent<RectTransform>());
    18.             RTC.anchorMax = Vector2.zero;
    19.             RTC.anchorMin = Vector2.zero;
    20.             RTC.anchoredPosition3D = Vector3.zero;
    21.             RTC.localEulerAngles = Vector3.zero;
    22.             RTC.localScale = Vector3.one;
    23.             RTC.sizeDelta = Vector2.one;
    24.    
    25.             RadarCamera.targetTexture = RT;
    26.             RadarCamera.clearFlags = CameraClearFlags.SolidColor;
    27.             RadarCamera.backgroundColor = BGColor;
    28.             RadarCamera.rect = new Rect (0,0,1,1);
    29.             RenderTarget.GetComponent<Renderer> ().material = RenderMaterial;
    30.         }
    31.    
    32.         if (!EnableTargetList) {
    33.             _TargetList.gameObject.SetActive (false);
    34.         } else {
    35.             UpdateDisplayedList ();
    36.         }
    37.     } // This is the Start() closing Bracket



    3. FX_3DRadar_RID Replace the MakeRID() method with the following.

    Code (CSharp):
    1.     void MakeRID(){
    2.         //Make This Objects Radar ID
    3.         RIDI = FX3DRM.MakeImage("RID_Icons", 0.0f, GameObject.Find("RadarTargets").transform);
    4.         RIDI.pivot = Vector2.zero;
    5.         Image_RIDI = RIDI.GetComponent<Image>();
    6.    
    7.         //Make This Objects VDI
    8.         if(FX3DRM.RenderVDI){
    9.             RIDV = FX3DRM.MakeImage("RID_VDI",0.0f, GameObject.Find("RadarTargets").transform);
    10.             RIDV.pivot = Vector2.zero;
    11.            
    12.             Image_RIDV = RIDV.GetComponent<Image>();
    13.             Image_RIDV.raycastTarget = false;
    14.             RIDV.sizeDelta = Vector3.zero;
    15.         }
    16.    
    17.         //Make This Objects VDI Base
    18.         if(FX3DRM.RenderRIDB){
    19.             RIDB = FX3DRM.MakeImage("RID_Base",0.0f, RIDV.transform);
    20.             RIDB.pivot = Vector2.zero;
    21.             RIDB.anchoredPosition3D = FX3DRM.RIDBOffset;
    22.             Image_RIDB = FX3DRM.SetImage(RIDB.GetComponent<Image>(), FX3DRM.Sprite_RIDBase, false);
    23.         }
    24.    
    25.         if(!IsNAV && FX3DRM.SelectableRID){
    26.             RIDI.gameObject.AddComponent<Button>();
    27.             RIDI.gameObject.GetComponent<Button>().onClick.AddListener(() => { ThisHID.GetComponent<FX_MouseSelect>().SetTarget();});
    28.             RIDI.gameObject.AddComponent<FX_MouseSelect>().ThisParent = ThisTransform;
    29.         }
    30.  
    31.         if (FX3DRM.RadarPos == FX_3DRadar_Mgr._radarPos.RenderToTexture) {
    32.             RIDI.localScale = Vector3.one;
    33.             RIDI.localEulerAngles = Vector3.zero;
    34.  
    35.             if (FX3DRM.RenderVDI) {
    36.                 RIDV.localScale = Vector3.one;
    37.                 RIDV.localEulerAngles = Vector3.zero;
    38.             }
    39.  
    40.             if (FX3DRM.RenderRIDB) {
    41.                 RIDB.localScale = Vector3.one;
    42.                 RIDB.localEulerAngles = Vector3.zero;
    43.             }
    44.         }
    45.  
    46.             DisableThis();
    47.     }
     
    Last edited: Jul 28, 2016
  43. Cyrussphere

    Cyrussphere

    Joined:
    Jul 1, 2016
    Posts:
    129
    great package! I see the options for moving the radar to any of the 4 corners and I also see the Custom function but how do I use this to move the radar? I am wanting to get the radar directly in the bottom center of the screen? Also I havn't figure out the proper way to make the entire thing a bit smaller either without messing up a bunch of stuff.
     
  44. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Hi Cyrussphere,

    The radar is displayed to the screen using camera layering / depth. When using the custom position you will change the radars screen position by adjusting the _RadarCamera Viewport XYWH located on the camera its self.

    Note : No screen UI elements are tied to the radar camera viewport position so things like Range and Zoom will need to be placed to your liking.

    To change the size of the radar you would adjust the _RadarCameras perspective Field of view or the Orthographic Size depending on which view mode you are in. I recommend not setting perspective / orthographic on the camera its self, instead change this from the the radar manager by clicking the button "Switch To Perspective / Switch To Orthographic" as this will cover some necessary shader settings related to radar outline drawing. So switch rendering modes first with the button then set the FOV or Size.
     
  45. Cyrussphere

    Cyrussphere

    Joined:
    Jul 1, 2016
    Posts:
    129
    Awesome, thank you! One last question. What is the best way to utilize the Target Status bars? I've tried adding to the FX_3DRadar_Mgr script to use the If (CurTarget) value, then reach out to the enemy script on the CurTarget to get the Hull and Shield values for the sliders. While this works I keep getting Null Object references whenever the target is destroyed
     
  46. ForceX

    ForceX

    Joined:
    Jun 22, 2010
    Posts:
    1,102
    Null on destroy :
    When you want to destroy an object call the DestroyThis() function on the FX_3DRadar_RID script. This does all the necessary cleanup when an object is destroyed.

    Object.FX_3DRadar_RID.DestroyThis();

    Status Bars:
    The radar actually does not control the target status bars only there enable/disable state for the UI. Updating the bars will need to be done through your own script. This is because the status bars require a health system that ranges from 0-1 and is not part of the system.

    You can load one of the included demos and look at the example health status script to see how you could do this.

    Best way create a static or singleton instance of the status bars and update them that way.

    You can set your target condition with the Object.FX_3DRadar_RID.SetAsActiveTarget(). Add any code here to setup your status bars to access your health script for this object.
     
    Last edited: Sep 6, 2016