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 superventure · Dec 14, 2014 at 11:39 PM · curvepointsbezierarc

Bezier curve confusion on 2 points

I was looking at this http://docs.unity3d.com/ScriptReference/Handles.DrawBezier.html in the docs for how to draw a bezier curve but I am confused.. How do I get it to just be an upward arc/curve between to different game Objects? alt text

bezier.png (197.9 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by richyrich · Dec 15, 2014 at 12:21 AM

The link you have given is for Bezier in the scene view, not game.

The link below is what you want. It has loads of examples of the different Bezier flavours and all wrapped in a Unity project. Enjoy.

http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/

However, for your purposes, you might not actually need a Bezier. Instead, Vector3.Slerp might do all you need (Spherical Linear interpolation) to figure out the points spherically between two points (Vectors)

http://docs.unity3d.com/ScriptReference/Vector3.Slerp.html

Comment
Add comment · Show 4 · 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 superventure · Dec 15, 2014 at 03:22 AM 0
Share

well... I do use it in game with function OnDrawGizmos(){ to render it like any other line. The thing is I am confused as to why it will not just allow the curve to be between two chosen points ins$$anonymous$$d of the world point zero to a target, ie

 var width : float = HandleUtility.GetHandleSize(target.transform.position) * foo;
             Handles.DrawBezier(target.transform.position, transform.position, transform.up, -transform.up, Color.red, null, width);


Here the line starts and ends at the transforms, but the center directs to the world point zero. I trying to cut that out so it will be a regular arc

avatar image taxvi · Dec 15, 2014 at 09:29 AM 0
Share

hmm... are you sure that the target is not a child of an object at Vector3.zero? :/

avatar image richyrich · Dec 15, 2014 at 11:21 AM 0
Share

I do use it in game with function OnDrawGizmos(){

In Unity there are two tabs 'Scene' and 'Game'. OnDrawGizmos is only for editor/scene. When you build your game, the player will not see gizmos.

avatar image richyrich · Dec 15, 2014 at 12:12 PM 0
Share

Hmm, ok. Forgetting what this is for, to get you an arc as required...

From:

  var width : float = HandleUtility.GetHandleSize(target.transform.position) * foo;
              Handles.DrawBezier(target.transform.position, transform.position, transform.up, -transform.up, Color.red, null, width);

To:

  var width : float = HandleUtility.GetHandleSize(target.transform.position) * foo;
              Handles.DrawBezier(target.transform.position, transform.position, transform.position + Vector3.up * 10f, p1.transform.position + Vector3.up * width, Color.red, null, width);

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

27 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

Related Questions

Controlling the curvature of a Bézier curve 2 Answers

Which Variables control the shape of a Beizer Curve? 1 Answer

iTween, HOTween, Spline Controller and Others 1 Answer

How can I make a Lerp move in an arc instead of a straight line? 2 Answers

[Vectrosity] 3d bezier curve not generated correctly 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