Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:44:06+00:00 2026-06-03T11:44:06+00:00

I’ve created a basic HUD radar system based on 3D objects (Plane), the script

  • 0

I’ve created a basic HUD radar system based on 3D objects (Plane), the script detect the enemy and follow him on screen, but my problem is ,sometimes HUD go to out of the screen area.

Here is my code:

#pragma strict

// ******Public dimentions ******
public var AircraftObject : Transform;
// ******Private dimentions ******
//Fetch CpuScript class to get some varibles
private var mainClass : CpuScript;
private var isRenderer : boolean;
private var aircraftArea : float;
//Other perfabs
private var Spd : GameObject;
private var Alt : GameObject;
private var Trg : GameObject;
//Calculating varibles
private var Distance : int;
private var Speed : int;


function Awake()
{
    //Finding all objects
    findObjects();
    //Set PlayerScript into the mainClass
    mainClass = gameObject.GetComponent(CpuScript);
}

function FixedUpdate() 
{
    isRenderer = mainClass.isProximity;
    aircraftArea = mainClass.mainObjectArea;
    transform.position.x = aircraftArea / 6;
    //Set GUI's
    guiControl();
    getValue();
}

function guiControl()
{
    Spd.GetComponent.<TextMesh>().text = Speed + " Knot";
    Alt.GetComponent.<TextMesh>().text = "Enemy detected";
    Trg.GetComponent.<TextMesh>().text = Distance + " Ft";
}

function getValue()
{
    Distance = Vector3.Distance(AircraftObject.transform.position, mainClass.AircraftDistance) * 4;
    Speed = Random.Range(100, 300);
}

function findObjects()
{
    Spd = GameObject.Find("Speed");
    Alt = GameObject.Find("Alt");
    Trg = GameObject.Find("AimTarget");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:44:08+00:00Added an answer on June 3, 2026 at 11:44 am

    it impossible to say from the code you have shown exactly why your 3d hud is going off screen.

    But if you want to keep any 3d object, like your HUD, on screen at all time you will need to make sure it is being rendered onscreen by a camera at all times.

    This can be done in a number of ways.

    One way, would be to:

    1. use a second camera to render the HUD
    2. set its clear flags to depth only (in the inspector)
    3. set this camera’s depth to higher than the main camera (in the inspector)

    As long as you dont move this second camera then the HUD should always be displayed.

    You will also need to make sure the main camera does not render the HUD.
    Do this by:

    1. changing the layer of the HUD (create your won HUD layer).
    2. set the hud camera to render only this layer.
    3. set the main camera to render all other layers apart from the HUD layer.

    You do this using the culling mask drop selector in the inspector for both your cameras.

    FYI: you can also set the culling masks of the cameras in code but to do this you will need to use the bitwise operators.

    Alternative methods would include, making the HUD a child of the main camera in the scene view, so that when the camera moves the HUD moves to.
    However, this may lead to your HUD being obscured by other gameobjects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.