Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by wenhua · Jan 18, 2012 at 10:04 AM · timermenu

Timer indication and flight Log Information

alt text" />

Red circle=Helicopter icon, point1 is the location for helicopter to fly to follow by point2

Basically i am doing this new function(make New Flight log) This image show the places for helicopter to fly to. So i wanted to create somethings able to on/off the log. The log is able to display the distance from the helicopter starting point to the point1. as well for other point2 .... and also to display the time around that to reach it any1 has any idea. pls help me Thx below is script for the when i click to add waypoint 1 and formore.

//mouseclick to add waypoints

             if (Helicopter_Script.flightState == 0)
             {

                 if (Input.GetMouseButtonDown(0))
                 {

                     position = Input.mousePosition;

                     if (position != prevMousePosition)
                     {

                         prevMousePosition = position;

// Debug.Log("MouseClicked: mousePosition (x) - "+position.x + ", (y) - "+position.y);

                         if ((position.x>=20 && position.x<=570) && (position.y>=150 && position.y<=780))
                         {

                             if (helicopter.GetComponent( "Helicopter_Script" ).wayPoints.length == 0)

                                 GameObject.Find("Home").renderer.enabled = true;
                         
                             if (helicopter.GetComponent( "Helicopter_Script" ).wayPoints.length < maxWaypoints)
                             {        

                                 points1.push(position);
                                 linePoints = new Vector2 [points1.length + 1];
                                 points1.ToBuiltin(Vector2).CopyTo(linePoints,0);
                                 linePoints[linePoints.length-1] = points1[0];
                                 if (line1 != null) Vector.DestroyLine(line1);
                                 line1 = new VectorLine("Line1", linePoints , Color.red, null, 2.0, LineType.Continuous);
                                 Vector.DrawLine(line1);
                                 
                                 mapPosition.z = (position.y - 150) * (3300.656 + 1327.897) / (780 - 150) + (-1327.897);
                                 mapPosition.x = (position.x - 20) * (824.0381 + 3285.686) / (570 - 20) + (-3285.686);
                 
                                 object = "p"+(helicopter.GetComponent( "Helicopter_Script" ).wayPoints.length+1);                                            
                                 GameObject.Find(object).transform.localPosition.x = mapPosition.x;
                                 GameObject.Find(object).transform.localPosition.z = mapPosition.z; 
                                 GameObject.Find(object).renderer.enabled = true;
                                 
                                 Helicopter_Script.wayPoints.Push(mapPosition);
                                 Helicopter_Script.isNewWayPoint = true;
                                 Debug.Log("numWaypont - "+Helicopter_Script.wayPoints.length +", mapPosition - "+mapPosition);
                             }
                         }
                                                                                 
                     }
                 }
             }
             
             //draw lines to waypoints

// pathPoints[pathIndex] = thisTransform.position;

// pathLine.maxDrawIndex = pathIndex-1;

// Vector.DrawLine (pathLine);

// Vector.SetTextureScale (pathLine, 1.0);

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

pause menu on android phone 1 Answer

Audio after Audio Loop 1 Answer

One GameObjects Script Activating Another GameObjects Script 1 Answer

Explosive like in COD 4? 1 Answer

Timer activates script 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges