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 xandermacleod · May 25, 2013 at 07:07 AM · itweendisplaydrawcurvetrajectory

How to display a bezier curve between transforms in-game rather than in editor?

I'm using an iTween path to currently previsualize the flight path of an arrow before it is launched and I would like the player to see this pre-visualization in-game as well.

Is there a way to see the path in-game rather than just using the DrawPath function to see the path in the editor's scene view?


I thought about the idea of shooting out particles along the same trajectory to previs the path, but I don't know how to destroy them all when the character changes the trajectory / how to get the particle to instantly draw out the entire flight-path without having to be launched at the same (potentially slow) velocity as my arrow.

Any suggestions?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · May 25, 2013 at 05:50 PM

You can generate a list of points along the curve using iTween.PointOnPath(). The last parameter is the fraction along the path, so you can tune this to create whatever density of points you want. You could even pre-calculate the total distance between the control points and scale the number of points based on the length.

As for drawing the line, you could simply place game objects at your calculated points. If the game objects are non-uniform, you can use Transform.LookAt() to look at the next point in the list to orient them. You could also delay the rendering of each game object based on the fraction it is along the path to get the effect of highlight the path in order.

Note if you want to draw a line (including a dotted line) I highly recommend the Vectrosity (available in the Asset Store).

Comment
Add comment · 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
0

Answer by Varaughe · Dec 09, 2014 at 07:09 PM

If you edit an AnimationCurve in Unity, you've actually got a Bezier curve, so you may model your curve using this built-in class from unity engine(AnimationCurve) and you can get the "Runtime Curve Editor" from the asset store, with that you can visually edit in-game such curves, the source code is also available with that package ,that in the case you only want to extract the code for drawing a bezier curve in-game(at runtime) . Check this out : http://u3d.as/content/rus-artur-pfa/runtime-curve-editor/5C4

Comment
Add comment · 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

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

14 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

Related Questions

Custom Easing Types using Curves for Motion? 3 Answers

Aim preview for projectile trajectory 1 Answer

iTween, HOTween, Spline Controller and Others 1 Answer

Using iTween.PutOnPath 1 Answer

Animation Curve evaluate beyond maximum 2 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