Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 chengdianpengyuyan · Dec 04, 2018 at 03:02 PM · vectrosity

I'm trying to make an arc with vectrosity5,but i‘ve got some problems.

My aim alt text

 var segments = 15;
         float ox = s.x + oi;
         float oy = s.y + oj;
         Vector3 o = new Vector3(ox, oy, s.z);
         var linePoints = new List<Vector3>(segments + 1);
         float sdegree = 0;
         float edegree = 0;
         var r = Mathf.Sqrt((s.x - o.x) * (s.x - o.x) + (s.y - o.y) * (s.y - o.y));
         
         //startdegree
         //0-90degree  //Mathf.PI / 2 +* Mathf.Rad2Deg
         if ((s.x - o.x >= 0) && (s.y - o.y > 0))
         {
             sdegree = (Mathf.Asin((s.x - o.x) / r)) * Mathf.Rad2Deg;
             Debug.Log("1" + sdegree);
             
         }
         //90-180degree
         if ((s.x - o.x > 0) && (s.y - o.y <= 0))
         {
             sdegree = (Mathf.PI / 2 + Mathf.Asin((o.y - s.y) / r)) * Mathf.Rad2Deg;
             Debug.Log("2" + sdegree);
         }
         //180-270degree
         if ((s.x - o.x <= 0) && (s.y - o.y < 0))
         {
             sdegree = (Mathf.PI + Mathf.Asin((o.x - s.x) / r)) * Mathf.Rad2Deg;
             Debug.Log("3" + sdegree);
         }
         //270-0degree
         if ((s.x - o.x < 0) && (s.y - o.y >= 0))
         {
             sdegree = (2 * Mathf.PI - Mathf.Asin((o.x - s.x) / r)) * Mathf.Rad2Deg;
             Debug.Log("4" + sdegree);
         }
         //-----------------------enddegree-----------------------------------
         //0-90degree
         if ((e.x - o.x >= 0) && (e.y - o.y > 0))
         {
             edegree = (Mathf.Asin((e.x - o.x) / r)) * Mathf.Rad2Deg;
             Debug.Log("1" + edegree);
             Debug.Log(Mathf.Asin((e.x - o.x) / r));
         }
         //90-180degree
         if ((e.x - o.x > 0) && (e.y - o.y <= 0))
         {
             edegree = (Mathf.PI / 2 + Mathf.Asin((o.y - e.y) / r)) * Mathf.Rad2Deg;
             Debug.Log("2" + edegree);
         }
         //180-270degree
         if ((e.x - o.x <= 0) && (e.y - o.y < 0))
         {
             edegree = (Mathf.PI + Mathf.Asin((o.x - e.x) / r)) * Mathf.Rad2Deg;
             Debug.Log("3" + edegree);
         }
         //270-0degree
         if ((e.x - o.x < 0) && (e.y - o.y >= 0))
         {
             edegree = (2 * Mathf.PI - Mathf.Asin((o.x - e.x) / r)) * Mathf.Rad2Deg;
             Debug.Log("4" + edegree);
         }
 
 
         var line = new VectorLine("Line", linePoints, 0.1f, LineType.Continuous);
         //var myLine = new VectorLine("Line", linePoints, 2f);
         line.MakeArc(o, r, r, sdegree, edegree, segments);
         line.Draw3D();

in unity alt text

qq图片20181204205041.jpg (94.8 kB)
qq图片20181204205058.png (6.6 kB)
Comment
Add comment · Show 1
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
avatar image chengdianpengyuyan · Dec 04, 2018 at 01:05 PM 0
Share

the vectrosity5 coding document: You can draw part of a circle or ellipse easily with this function. It’s very similar to $$anonymous$$akeEllipse, except you specify the start and end points of the arc in degrees. Also, the pointRotation parameter isn’t used with $$anonymous$$akeArc. myLine.$$anonymous$$akeArc (origin, up, xRadius, yRadius, startDegrees, endDegrees, segments, index); At the $$anonymous$$imum, you need to define the origin, radii, and the start and end degrees: myLine.$$anonymous$$akeArc (origin, xRadius, yRadius, startDegrees, endDegrees); As with $$anonymous$$akeCircle/$$anonymous$$akeEllipse, the up vector is only used with Vector3 points. If the segments parameter is left out, the arc uses all available points in the line. Along with segments, the index is useful for creating multiple arcs in the same VectorLine (which should use LineType.Discrete to avoid having all the arcs connected to each other). When used with Vector2 points, the degrees start at 0 at the top and go clockwise around the circle to 360. When used with Vector3 points, where the “top” is depends on the up vector and the camera orientation. If the supplied degrees go over 360, they wrap around, so for example 370° is the same as 10°. The same is true for negative numbers: -10° is the same as 350°. You can have the start degrees be greater than the end degrees, which is useful for defining which part of the circle is drawn in the case where you want to wrap around the top.

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

94 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Vectrosity line smoothing issue. 0 Answers

Vectrocity error message 2 Answers

Drawing tiny objects (grid problem) 2 Answers

Vectrosity end caps Draw3D() 1 Answer

Asset not importing 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