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 BakeSlots · Sep 07, 2011 at 12:55 PM · wheelcollidermotortorque

my car isn't moving

hi, i'm just trying to learn how to use WheelCollider.motorTorque , and i saw this script somewhere around

     public WheelCollider fr;
 public WheelCollider fl;
 public WheelCollider br;
 public WheelCollider bl;

 public float speed = 10.0f;
 public float steerSpeed = 10.0f;

 public GameObject COM;

 int gear = 4;

 void Start ()
 {
     rigidbody.centerOfMass = COM.transform.localPosition;
     rigidbody.angularDrag = 10;

     br.motorTorque = 30;
     bl.motorTorque = 30;
 }
 
 void Update ()
 {
     if (Input.GetKeyDown("1"))
     {
         gear = 1;
     }

     if (Input.GetKeyDown ("2")) 
     {
         gear = 2;
     }

     if (Input.GetKeyDown ("3"))
     {
         gear = 3;
     }

     if (Input.GetKeyDown("4"))
     {
         gear = 4;
     }
 }

 void FixedUpdate()
 {
     fr.steerAngle = Input.GetAxis("Horizontal") * steerSpeed;
     fl.steerAngle = Input.GetAxis("Horizontal") * steerSpeed;

     br.motorTorque = Input.GetAxis("Vertical") * speed * gear;
     bl.motorTorque = Input.GetAxis("Vertical") * speed * gear;


     
 }


so i made a box and some clyinders to make them a car and an empety GameObject to be the COM and centered it to all the wheels to test this script(i didn't parent any thing)

and i tested it but the wheels doesn't move, the front wheel's WheelCollider is rotating well but it never moves, sorry for being so stupid >,< :)

Comment
Add comment · Show 3
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 Waz · Sep 07, 2011 at 12:58 PM 0
Share

You may be better off starting with the Car Tutorial, it's free on the Asset Store.

avatar image BakeSlots · Sep 07, 2011 at 01:00 PM 0
Share

yea, i'm sure i'll check it :) , but please for now can u tell me why isn't it moving , and i'm sorry for that.

avatar image Waz · Sep 07, 2011 at 01:36 PM 0
Share

Sorry, but for me at least, it's easier to help people after they have learned something from a book. I'm lazy see. Best of luck.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by vanofthedawn12 · Aug 20, 2012 at 03:10 PM

It is because you are not updating the motorTorque on the fixed update.. I imagine your car moving a bit after a torque of 30 is applied but I also think that your car is heavy to be moved by a torque of 30.... try something like 1000.0f.. just imagining, not sure if it'll work

Comment
Add comment · 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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Applying Torque to wheelcollider 1 Answer

Question about motorTorque 0 Answers

My AI controlled car "stalls" after making a turn based on a collider 1 Answer

Unity 5 wheel collider throttle "stuck". 1 Answer

Add Force or Motor Torque .. Which is better for creating a car? 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