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 /
avatar image
0
Question by dcox45 · Mar 24, 2019 at 11:27 PM · mathspawningaugmented-realitybezier

Spawn 1-4 players around a Bezier curve?

I need to spawn 1-4 players at points around a bezier curve surrounding a basketball net (so around a 3-point line, essentially). This will be an AR environment, so there will be no actual 3-point line in the scene - I need a way to spawn a given number of players at equal distances from each other. So if there are 2 players, they will be placed at 10 and 2 of a clock-face. 4 players will be placed at roughly 9, 11, 1, and 3 of a clock-face.

Note: No player can be on the top of the oval (directly facing the net), as this would be an unfair advantage.

alt text

image.png (49.3 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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by WarmedxMints · Mar 25, 2019 at 12:11 AM

You can get a point on the curve using this method;

     public static Vector3 GetPointOnCurve(Vector3 startPoint, Vector3 midPoint, Vector3 endPoint, float t)
     {
         return Vector3.Lerp(Vector3.Lerp(startPoint, midPoint, t), Vector3.Lerp(midPoint, endPoint, t), t);
     }

From there is just a matter of passing a value between 0 and 1 in the t parameter to get a point at the percentage you want the player to be.

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 king_opping · Mar 25, 2019 at 06:50 AM 1
Share

yeah lerp maybe nice, but i think he need a reference for the half round curve placement.. along that line.

avatar image
1

Answer by elenzil · Mar 25, 2019 at 06:42 PM

bezier curve is more complex, but if you want to choose points on an arc it's pretty simple.

 // return a point on the unit circle lying in the XZ plane,
 // uniformly distributed between degreesA and degreesB.
 // "0 Degrees" is taken to be Vector3.forward, aka [0, 0, 1].
 Vector3 PointOnArc(float degreesA, float degreesB) {
   float deg = Random.Range(degreesA, degreesB);
   return Quaternion.AngleAxis(deg, Vector3.up) * Vector3.forward;
 }

I haven't actually compiled that, but it should work. Note you'll need to scale the result by the size of that semi-circle, and translate it by the center of the semi-circle.

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

118 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Circular curve using bezier formel 1 Answer

Calcultate spawn position based on spawn volume's rotation 2 Answers

Cloud recognition in Vuforia 0 Answers

Controlling roll rotation when travelling along bezier curves 1 Answer

Subdivide Bezier Curves 3 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