• 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 xlordt · Sep 28, 2013 at 04:08 AM · unity 4.2

Object wont move when following tutorial

hey guys I am new to Unity, I am currently fallowing this tutorial http://www.youtube.com/watch?v=N49cfP-MWJA currently I have all object set and ready to go, but when its time to create the script the object (ball) wont move at all. I created the script first then created the rigidbody. Yet the ball wont move at all.. is there an order of how I am supposed to create this? or it does not matter? The JS file is there when I click on the ball, and it is checked.. I also deleted the component and re applied it.. by dragging it to the ball, yet still nothing. I am using Unity 4.2.1, if anything here is the code.

  var movezSpeed = 100;
 
  function Update () 
  {
          var rotation : float = Input.GetAxis ("Horizontal") * movezSpeed;
          
          rotation *= Time.deltaTime;
          rigidbody.AddRelativeTorque (Vector3.down * rotation);
  }

also are there any limitations when using JS over C#? What I mean is... can I stick to JS or at a certain point will I need C#?

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 xlordt · Sep 28, 2013 at 03:52 AM 0
Share

btw.. upon hitting play, the ball does fall down to the box object... just in case.

1 Reply

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

Answer by robertbu · Sep 28, 2013 at 04:20 AM

For a ball on top of the cube (Y being up) and a camera looking towards positive 'z', your AddRelativeTorque() should be using Vector3.forward or Vector3.back:

 rigidbody.AddRelativeTorque (Vector3.back * rotation);

If this change does not fix the app, look under Edit>Project Settings>Input and verify that 'Horizontal' has been setup correctly. The default setup as the arrow keys and I think WASD setup.

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 xlordt · Sep 28, 2013 at 04:34 AM 0
Share

oh wow, you are correct, but how do I change this back to using down ins$$anonymous$$d of up? please forgive me for my ignorance, I just started using Unity today.. yet I do know JS, and some C#

avatar image robertbu · Sep 28, 2013 at 04:36 AM 0
Share

I don't understand your followup. Change what from down ins$$anonymous$$d of up. If the ball is rotating the wrong way based on your input keys, change Vector3.back to Vector3.forward. Note JS and the version of JS used by Unity (often referred to as 'Unity Script'), have some fundamental differences.

avatar image xlordt · Sep 28, 2013 at 04:39 AM 0
Share

Yes sorry,l I got it.. Really thank you very much 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.

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

15 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

Related Questions

How to run Unity3D on Ubuntu 6 Answers

What is less in my computer? 0 Answers

Handling unsupported asset bundles 0 Answers

Unity's userinterface got blurry! 0 Answers

User updated her Unity and now UI is flickering on move 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