Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by DaiMangouDev · Feb 25, 2016 at 09:29 PM · c#vector3editor-scriptingbezier

How do I draw a Bézier curve to have 90 degree angles ?

Hi guys , I am trying yo understand how to draw bezier curves that have 90 degree angles like this alt text

Here is a method i use to draw a curve between two points. The typical script you usually see for drawing bezier curves in unity.

However this give me a very curvy bezier , I am trying to get the bezier to have 90* angles where they would usually curve

         public static void DrawConnector(Vector2 statPoint, Vector2 endPoint)
         {
 Event e = new Event();
             Vector3 startPos = new Vector3(statPoint.x, statPoint.y);
             Vector3 endPos = new Vector3(endPoint.x, endPoint.y);
             Vector3 startTan = startPos + Vector3.right * 50;
             Vector3 endTan = endPos + Vector3.left * 50;
             Color bizcol = (endPoint != e.mousePosition) ? Color.red: Color.blue);
 
 
             for (int i = 0; i < 1; i++) 
             Handles.DrawBezier(startPos, endPos, startTan, endTan, bizcol, null, 2);
 
         }


90db.png (2.9 kB)
Comment
Add comment · Show 2
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 Cherno · Feb 25, 2016 at 10:02 PM 0
Share

I think the tans need to be 0.

avatar image phil_me_up Cherno · Feb 25, 2016 at 10:04 PM 0
Share

No, see my answer below. 0 tangents would give you something like this: http://cubic-bezier.com/#0,0,1,1 (i.e. a straight line)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by phil_me_up · Feb 25, 2016 at 10:03 PM

A tool like this will help visualise what you're doing: http://cubic-bezier.com/#.55,0,.44,.99

What you probably want is something more like this: http://cubic-bezier.com/#.55,0,1,.4

Note that in your code your first tangent is Vector3.right, and the second is Vector3.left (illustrated in the first link), where as you'll probably want one tangent as Vector3.right, and the other as Vector3.down (or Vector3.up * -1 as I'd write it)

Why? Well consider what a tangent is. At your control points (the start and end positions), in natural language a tangent is a line which will just touch the control point and be completely parallel to the curve at that point.

Comment
Add comment · Show 1 · Share
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 DaiMangouDev · Feb 25, 2016 at 11:52 PM 0
Share

alt text For what I'm seeing here , I would really need to piece together multiple bezier curves to get this effect then ? This is what i am ai$$anonymous$$g for

Also, that link is great !! thanks for that.

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

109 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 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

Moving an array of Vector3 with the GameObject (Path-System) 0 Answers

I want to use a variable in the Unity editor source file to get it from a regular script. 0 Answers

(Help) I am having trouble with creating a simple 2D game in Unity. Please help. :) 0 Answers

How to change Force direction immediately? 1 Answer

Movement Sticking 0 Answers


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