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 /
  • Help Room /
avatar image
0
Question by mads232 · Dec 03, 2015 at 11:49 PM · unity 5wheelcollider

motorTorque keeps on being applied

Hello Unity Answers!.. (So I already asked this question on the forums, but everything seems so dead on there. Is it the same thing on here? I hope not) Anyways..

So I got this script which is supposed to control my vehicle, which got 3 gears. Forward, neutral and backwards.

Although everytime I shift gear, it does not stop applying the motorTorque.

Here's what I've found out: Nothing to do with input (My axis's). (My old script works just as it should with Axis) Gear script work as it should As soon as I remove all these if conditions, it works as it should.

This is my gear shifting script. (See link)

This is alright. Just posting it for better understanding.

http://pastebin.com/k0YJgr8t

This is my primary motorscript. (See link)

As you can see, it should only drive forward when gear is in 2. (Or backwards when in 0)

At first when I start the game and the gear is set to 1 (which is neutral), it seems to work. As soon as I kick it in 2, it starts to drive forward slowly (As it should. idleMotor applies some torque to make it go slowly forward.)

But if I then shift it back to 1 (neutral) it just doesn't stop applying that torque from idleMotor. It keeps going forward. The same happens in the reverse gear, or if I speed it up with VerticalVehicle Axis.

http://pastebin.com/sA1XsMWK

Anyone able to find what I'm doing wrong? Feel free to ask for more information or explanation!

Thanks!

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 mads232 · Dec 05, 2015 at 08:37 PM 0
Share

By doing some debugging myself, it does seem to be something affected by my gear script. Somehow, the input is not very responsive, and it takes several key presses, before it decides to actually switch gear.

1 Reply

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

Answer by mads232 · Dec 06, 2015 at 10:04 PM

I was calling my functions in fixedUpdate, so after changing that to Update, it stopped doing that. (derp)

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

41 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

OnCollisionEnter cant work with wheel colliders 1 Answer

good setting for WheelCollider 0 Answers

Wheel Colliers sinking into ground 1 Answer

WheelColliders problem 1 Answer

Wheel Collider 0 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