• 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 blackmethod · Jul 06, 2011 at 03:34 AM · physicssphereballrollrolling

Create a "free" rolling ball controlled by player

So I asked t$$anonymous$$s question a couple weeks ago but I didn't get a response that worked. What I'm trying to figure out is how I can make a cube controlled by a player roll freely. Not just a rolling animation, but more of a roll due to physics. So I wouldn't need to make around 30 animations just for it to roll. Here is an example of what I would like to figure out how to do: http://www.youtube.com/watch?v=yuyiItRJ6EE (Marble blast ultra) just the rolling mechanism in it. Help on t$$anonymous$$s would be greatly appreciated. T$$anonymous$$ngs I have already tried (May have missed some):

  • Adding a Rigidbody to the sphere

  • Using animations on the sphere.

  • And yes, I have tried adding a texture so I know it's not rolling =(

Thanks ahead of time - Valestrom

Comment
Add comment · Show 1
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 Jason B · Jul 06, 2011 at 04:00 AM 1
Share

I don't mean to get you down, but this question has been asked many, many times, and successfully answered almost every time. The search function would probably have worked wonders. But as Bunny says, AddTorque is essential, as well as an understanding of Physics Materials so that you can apply enough friction to make rolling viable.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Jul 06, 2011 at 03:51 AM

  • Rigidbody

  • Rigidbody.AddForce

  • Rigidbody.AddTorque (esp. t$$anonymous$$s one)

Comment
Add comment · Show 3 · 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 blackmethod · Jul 06, 2011 at 05:08 AM 0
Share

I'll try that right away.

avatar image blackmethod · Jul 06, 2011 at 05:22 AM 0
Share

So now it rolls, thanks! All I should have to do now is make a character controller that adds force and torque?

avatar image blackmethod · Jul 06, 2011 at 05:38 AM 0
Share

I hope you can help with this, I have this as my code:

function FixedUpdate () { if (Input.GetButton("W")) { rigidbody.AddTorque (Vector3.forward 2); rigidbody.AddForce (Vector3.forward 2); } } function FixedUpdate () { if (Input.GetButton("S")) {

rigidbody.AddTorque (Vector3.-forward 2); rigidbody.AddForce (Vector3.-forward 2); } function FixedUpdate () { if (Input.GetButton("A")) { rigidbody.AddTorque (Vector3.left 2); rigidbody.AddForce (Vector3.left 2); } } function FixedUpdate () { if (Input.GetButton("D")) { rigidbody.AddTorque (Vector3.right 2); rigidbody.AddForce (Vector3.right 2); } }

But I get these errors

(Filename: Assets/Movementscript.js Line: 6)

Assets/Movementscript.js(12,29): BCE0044: expecting ), found '.'.

(Filename: Assets/Movementscript.js Line: 12)

Assets/Movementscript.js(12,42): BCE0043: Unexpected token: ).

(Filename: Assets/Movementscript.js Line: 12)

Assets/Movementscript.js(13,28): BCE0044: expecting ), found '.'.

(Filename: Assets/Movementscript.js Line: 13)

Assets/Movementscript.js(13,41): BCE0043: Unexpected token: ).

(Filename: Assets/Movementscript.js Line: 13)

Assets/Movementscript.js(19,38): UCE0001: ';' expected. Insert a semicolon at the end.

(Filename: Assets/Movementscript.js Line: 19)

Error: Analytics Event: 5(Compiler*UCE0001*';' expected. Insert a semicolon at the end.)(1): skipped because it was sent more than once in 0.10 seconds Assets/Movementscript.js(26,39): UCE0001: ';' expected. Insert a semicolon at the end.

(Filename: Assets/Movementscript.js Line: 26)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Strange sphere/physics rolling behaviour when scaled 1 Answer

Ball Doesn't Roll Down Hill - Physics Problem 3 Answers

How to make a ball that can roll? 2 Answers

Ball jump on collision problem 1 Answer

How to make a "pressure sensor" of sorts that when rolled over switches to another scene 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