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
2
Question by MrProfessorTroll · Nov 17, 2013 at 12:50 AM · collidersphereradiusprimitives

Increase the radius of Unity's primitive sphere?

How can I increase and decrease the radius of Unity's primitive sphere to my likings? I have to change the actual sphere, not the collider itself. I have searched google for this but they all are changing the actual collider, not the mesh. Thanks!!

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
1
Best Answer

Answer by robertbu · Nov 17, 2013 at 01:05 AM

Just change the localScale of the transform.

 var go = GameObject.CreatePrimitive(PrimitiveType.Sphere);
 go.transform.localScale = Vector3(scale, scale, scale);

...where 'scale' is a variable or some constant.

Your question asks about changing the actual mesh. Is there some reason that you need to mesh rather than scaling the transform? If so does it have to be done at runtime?

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 MrProfessorTroll · Nov 17, 2013 at 01:10 AM 0
Share

Well I have a plane dead center of the sphere. The plane has a material on it that looks like a blue ring. I am using this ring as a sound wave that emits from the player. I want to increase the sphere's radius so that the ring inside of it will increase as well, and when it hit an enemy, he would be alerted. That is why I am using a sphere. Is there some better way to do this?

avatar image MrProfessorTroll · Nov 17, 2013 at 01:13 AM 0
Share

alt text

As you can see, there is a plane (as a child of the sphere) and that plane has a material that looks like a sound wave. I created the sphere it is parented to does not have a mesh render, so you can only see the sound wave. When the player walks, i want to increase the sphere, thus increasing the sound wave and the collider.

sphere1.jpg (66.1 kB)
avatar image robertbu · Nov 17, 2013 at 01:39 AM 1
Share

Changing the Transform.localScale of the sphere will scale the plane as well. But if the only reason to use the sphere is scaling, then you can delete the sphere and just change the localScale of the plane.

avatar image MrProfessorTroll · Nov 17, 2013 at 02:15 AM 0
Share

I am using the sphere so that anybody that touches the ring will be alerted that the player is near. Thanks for your help!

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

17 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

Related Questions

Need to Find the Radius of an Object? 2 Answers

How to create a game object (sphere) with all components from a script? 1 Answer

How to transform a sphere collider 1 Answer

Retrieve 2d primitives from 3d colliders 1 Answer

Grenade Damage in Radius 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