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

Create a "free" rolling ball controlled by player

So I asked this 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 this would be greatly appreciated. Things 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 $$anonymous$$aterials 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. this 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/$$anonymous$$ovementscript.js Line: 6)

Assets/$$anonymous$$ovementscript.js(12,29): BCE0044: expecting ), found '.'.

(Filename: Assets/$$anonymous$$ovementscript.js Line: 12)

Assets/$$anonymous$$ovementscript.js(12,42): BCE0043: Unexpected token: ).

(Filename: Assets/$$anonymous$$ovementscript.js Line: 12)

Assets/$$anonymous$$ovementscript.js(13,28): BCE0044: expecting ), found '.'.

(Filename: Assets/$$anonymous$$ovementscript.js Line: 13)

Assets/$$anonymous$$ovementscript.js(13,41): BCE0043: Unexpected token: ).

(Filename: Assets/$$anonymous$$ovementscript.js Line: 13)

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

(Filename: Assets/$$anonymous$$ovementscript.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/$$anonymous$$ovementscript.js(26,39): UCE0001: ';' expected. Insert a semicolon at the end.

(Filename: Assets/$$anonymous$$ovementscript.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.

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

Simulating the graphics of a rolling 3D ball in a 2D game 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