• 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 Christoff · Dec 10, 2010 at 01:33 PM · charactercontrollerball

What is the best way to add a controller script to a sphere ?!

Im wanting to use a sphere as my main character in a game. IE: A Ball

I know il have to attach a ridgidbody to the sphere and other coliders etc

But where im stuck is the scripting, id like to make the ball roll around using w,a,s,d or arror keys etc..

please help.. thankyou.

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

Answer by TowerOfBricks · Dec 10, 2010 at 01:59 PM

For that you need to make a script.

Look up on the unity script documentation. http://unity3d.com/support/documentation/ScriptReference/index.html

And a Javascript (Unityscript) tutorial from the wiki http://www.unifycommunity.com/wiki/index.php?title=Head_First_into_Unity_with_JavaScript

And another Unityscript tutorial: http://forum.unity3d.com/threads/34015-Newbie-guide-to-Unity-Javascript-(long)

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 Christoff · Dec 10, 2010 at 02:10 PM 0
Share

Thanks

Do you have an example of a script however!? or an actual tutorial

avatar image
3
Best Answer

Answer by Proclyon · Dec 10, 2010 at 02:10 PM

You may need to use forces and a rigidbody rather than a character controller yes. Usually it is quite the opposite, so quite an interesting question!

Here's a script reference to help with the rigidbody, particularly the AddForce and AddTorque are interesting

Torque helps with rotating stuff around, and using just force on a ball should help with movement.

Getting any kind of realism on other objects you may need to give them rigidbodies aswell and start rolling stuff over like bowling. Go fiddle with that and see how far you get. Let me know it turns out if you will please :) Quite interested in this.

Comment
Add comment · Show 2 · 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 Statement · Dec 10, 2010 at 03:27 PM 1
Share

I think the Torque alone would satisfy the problem of making the ball roll. Also it is good to put physics materials that have high friction or the ball might just spin around on its place.

avatar image Proclyon · Dec 10, 2010 at 04:53 PM 0
Share

Hmm clever idea, I haven't been granted the luxury of time during my work to really play with PhysX but it sounds like that problem should definatly be considered!

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Crushing death in a plataform game using character controller 1 Answer

Character Controlling grinding along any non-flat Terrain 1 Answer

Collision CharacterController vs CharacterController 2 Answers

Finding an object is within an another 3 Answers

CharacterController and end of collision 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