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 OrsonXu · Oct 06, 2017 at 02:13 PM · shadertexturemeshmodel

How to get a sphere surface with a solid angle through script?

Hi, as a newbie in Unity, I have been trying to get a surface, or a shell of a sphere. The following picture may be a good example of what I want. alt text

The area A is exactly what I need, as a Gameobject in Unity. I hope that I can change the Omega programmatically (the value of the Omega is depended on the player).

Any suggestion will be appreciated.

solidangle.png (13.5 kB)
Comment
Add comment · Show 4
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 Glurth · Oct 06, 2017 at 03:41 PM 0
Share

Noting builtin like that exists. I suspect you will want to create a "$$anonymous$$esh", programmatically, so you can recompute it when Omega changes. https://docs.unity3d.com/ScriptReference/$$anonymous$$esh.html Lots of good stuff out there on creating a mesh at runtime, so I won't go into detail here.

avatar image OrsonXu Glurth · Oct 06, 2017 at 05:33 PM 0
Share

I am learning how to implement a mesh. Thanks for pointing out the direction :)

avatar image TreyH · Oct 06, 2017 at 05:30 PM 0
Share

So you need the Area (a number) or an object that represents that slice?

avatar image OrsonXu TreyH · Oct 06, 2017 at 05:33 PM 0
Share

The gameobject. Sorry about the confusion.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Kishotta · Oct 06, 2017 at 09:43 PM

What you're looking for is called a Spherical Cap. Using only the information you've given, it can be calculated with the formula: Α=2πr2(1-cosθ) where θ is the Ω in your original image.

As for creating an actual mesh out of this, you can use the Area calculated above to determine the number of bands on a Radial mesh. To close it up and make a proper "wedge" of your sphere, just link the outer vertices to the center of the sphere. I'm not sure how to make this work for the area OUTSIDE the cap (the rest of the sphere) but hopefully it helps some.

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

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

Stretch second texture within Shader 0 Answers

Prefabs made in Unity are insanely slow, and don't show textures. 0 Answers

How to make the inner edge of a watermelon? 1 Answer

3d text mesh hides plane object 1 Answer

Unmask a sprite with a quad mesh in runtime 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