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 harrie · Mar 28, 2011 at 12:45 PM · c#mathsteering

Steering left different value than steering right

hello, i have a little problem with my unity script. im using a slider in settings.cs to modify the speed and steering of my cart. They are both working, however when i press debug.log it shows that left steers less fast than right. Example: left -7.0f middle 0 right 9.0f it also occurs with other values such as -3,8 0 5,8.

i want it to be the same for both sides, so 8 0 8 or 5 0 5 and so on..

in my test situation i removed all objects/script and let left and right steer exact the same. result: 7 0 9, 6 0 8 so even if left and right are the same, left is less powerfull?

if ( steer > 0) { direction += (steer + steerpower) * Vector3.right; transform.Translate( direction * Time.deltaTime );

 }
 if ( steer < 0)
 { 
     direction += (steer + steerpower) * Vector3.right ;
     transform.Translate( direction * Time.deltaTime );

 }
 Debug.Log(direction);

the code im using to go left is Vector3.left, in the above example i showed that the same things have different values.

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
2

Answer by Statement · Mar 28, 2011 at 12:51 PM

Because you're adding steerpower and not multiplying it. Besides, that if-check is completely redundant.

direction += steer * steerpower * Vector3.right;
transform.Translate( direction * Time.deltaTime );
Debug.Log(direction);

Consider if steer is -4 and steerpower is 5.

-4 + 5 = 1.
-4 * 5 = -20.

That is, with -4 steer you'd still go right if you were adding the numbers. With multiplication you'd go left (as expected).

Comment
Add comment · Show 1 · 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 harrie · Mar 28, 2011 at 01:17 PM 0
Share

thanks alot it is working now.

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

No one has followed this question yet.

Related Questions

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

Shortest distance from a point to a vector 2 Answers

Trouble with Camera Rotation Math 2 Answers

Issue with seed-based generation [C#] 3 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