Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 AndreasX12 · Mar 24, 2013 at 09:27 AM · rigidbodycarforce

Rigidbody force?

Hello, I'am working on a car script and i would like the car to move forward when I press "W" for example :-) The car already has working WheelColliders, but how do I add force to the car in the car's direction?

Thanks, Andreas :-)

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

1 Reply

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

Answer by sparkzbarca · Mar 24, 2013 at 09:48 AM

rigidbody.addForce(transform.forward);

Comment
Add comment · Show 9 · 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 AndreasX12 · Mar 24, 2013 at 09:54 AM 0
Share

I can't seem to get it work, I put it in the Update void, but it has no effect on the car (the script is in the same gameobject as the rigidbody)

avatar image sparkzbarca · Mar 24, 2013 at 09:55 AM 0
Share

transform.forward * speed

though you put it in

void FixedUpdate (rididbodies only apply during fixedupdate) that shoudlnt have stopped it form working though

where is the blue line in the car when you select it in editor with local axes

avatar image sparkzbarca · Mar 24, 2013 at 09:56 AM 0
Share

im thinking your car is misoriented

avatar image AndreasX12 · Mar 24, 2013 at 10:00 AM 0
Share

So it should be rigidbody.AddForce(transform.forward * speed);?

And the blue line is to the left for the front of the car, can it be fixed in Unity, or should I rotate it in Blender? :-)

avatar image sparkzbarca · Mar 24, 2013 at 10:01 AM 0
Share

in blender yep your applying force left but its not enough force to overcome the resistnace of the wheels against the ground.

Show more comments

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

12 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

Related Questions

How to set max speed for this car ? 1 Answer

How can i set AddRelativeForce relative to how fast/slow im moving my mouse? 2 Answers

Add force which throws back an object 3 Answers

Car Accelerate Over Time. (JavaScript and RigidBody) 2 Answers

How to get all forces applied to a rigidbody 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