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 partyjohn · Feb 19, 2015 at 11:39 AM · addforceforcetorqueaddtorque

AddTorque() doesn't work when also using AddForce()

Here's my code:

function FixedUpdate () {

     moveTimer -= Time.deltaTime;
     if(moveTimer < 0.0f) finished = true;
 
     if(!finished) {
         UpdateForce();
         UpdateTurning();
     }
 }
 
 function UpdateTurning() {
     var horz:float = Input.GetAxis("Left Thumbstick Horizontal");
 
     rigidbody.AddTorque(Vector3.up * horz * ROTATE_SPEED * speedMultiplier, ForceMode.Impulse);
 }
 
 function UpdateForce() {
     var direction:Vector3 = transform.forward;
     rigidbody.AddForce(direction * speed * speedMultiplier, ForceMode.Acceleration);
 }

I'm using this code to move an object forward automatically, and have the user steer it.

The issue is that when I'm calling AddForce() and AddTorque(), the object barely rotates (a small, negligible amount).

What I've tried:

1) Only calling AddTorque(), and not AddForce(), works perfectly fine for rotating the object.

2) Calling AddRelativeForce() instead of AddForce() makes it go backward and the rotation is all sporadic.

3) When calling AddRelativeTorque(), there's no noticeable difference.

4) Changing the ForceMode on either call doesn't cause and noticeable difference.

Some notes: The rigidbody is not kinematic, and has drag and angular drag.

I've been working on this issue for several hours, so any help would be much appreciated! Thanks!

Comment
Add comment · Show 2
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 Owen-Reynolds · Feb 19, 2015 at 03:01 PM 1
Share

Is the object rolling/sliding on a surface, or through space (not sure how dynamic friction affects rotation.)

Have you looked at values for horz? I don't know what a thumbstick is, or how you set forward speed, but it might be that horz just happens to be smaller, in the "forward and turn" stick position.

Then, just for fun, what happens if you crank up the rotate speed, like x30? In other words, can it simply not turn well while moving, or does it suddenly just need higher values?

avatar image partyjohn · Feb 20, 2015 at 12:29 AM 0
Share

It's flying through space, so there's no friction being applied. Just drag.

The values for horz are okay. While testing, I made sure to only go left and right on the thumbstick, and this worked perfectly when AddForce() wasn't being applied.

Cranking the rotate speed, by the hundreds and thousands had no effect. I did find that there's a maximum angular velocity in the project settings which was super low, like 6. I had to crank that up to 200 to get a decent effect.

It seems that more torque/angular velocity is required to turn the object that's moving that when at rest. Is this a property in real physics?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by partyjohn · Feb 20, 2015 at 01:44 AM

Increasing the maximum angular velocity in the project's physics settings made it work, but it has some side effects.

I had to crank it from 6 to 200 to get the control I wanted, and it seems to increase the force of any collisions when the object is turning into it, like, scary increase! objects flying around at crazy speeds cause it casually turned into a wall.

Comment
Add comment · Show 2 · 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 partyjohn · Feb 20, 2015 at 12:31 AM 0
Share

The ship has the 'bouncy' physics material, but he amount of bounce I'm getting is ridiculous, specifically when rotating into the collision.

It seems that more torque/angular velocity is required to turn the object that's moving that when at rest. Is this a property in real physics?

Do I just need to find some kind of sweet spot with the maximum angular velocity, and the objects mass/force being applied to it?

Any idea what's causing the crazy collisions?

avatar image iShorty11 partyjohn · Apr 25, 2018 at 08:27 AM 0
Share

I realize this was over 3 years ago... But I'm having the same issue with the crazy bouncing due to a spin on the object. Did you every find a solution?

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Torque applied only after force 0 Answers

AddTorque does not use ForceMode as expected (Different than AddForce) 1 Answer

Figuring out the correct amount of torque to apply? 2 Answers

Trying to apply a force on a ball at certain angles but the ball moves back and forth or otherwise moves erratically 1 Answer

Calculate force for torque by specifying a required velocity 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