Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 BrettRiet · Apr 27, 2011 at 09:22 PM · rigidbodyinputairplaneaddtorque

AddTorque doesn't rotate?

Their are no console errors but this is the line i'm trying to make and it wont rotate, also just so you know it's part of my airplane, which has a 1000 mass rigidbody, and its already got a 350000 force acting on it to move it fast so could this be effecting it?

if(Input.GetKey("d") && (groundtrigger.triggered==0))
{
rigidbody.AddRelativeTorque(Airplane.transform.right * -banking);
}

i just tried making a test and i put a script like this on a cube. and it worked... then i copied and pasted it and made so it would be focused the the airplane and it doesnt work, but if im on the ground and i the torque is like 20000000 it would jump into the air, why wouldn't it rotate like it is supposed to, i even erased the trigger part? so i dont have to worry about that.

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 Chris D · Apr 27, 2011 at 09:29 PM 0
Share

first thing I'd check: is groundtrigger.triggered==0 true? Toss a print statement in there to ensure you're getting into the if statement.

avatar image BrettRiet · Apr 27, 2011 at 09:31 PM 0
Share

Yea i know thats true, i just tried without it and it still wouldn't rotate.

3 Replies

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

Answer by Jeston · Apr 27, 2011 at 09:49 PM

Does the rigid body have infinite air drag or is there a constraint on the rigidbody that locks rotation ? Also what is the nomenclature ? The script is applying a relative torque in the world right direction of an Airplane reference ?

try doing something basic first:: Airplane.rigidbody.addRelativeTorque( Vector3.right, 100000);

Sidenote: I prefer the style where the rigid body has low mass, and I account for the forces in my controller rather than have it on the rigidbody.

Comment
Add comment · Show 3 · 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 BrettRiet · Apr 27, 2011 at 09:52 PM 0
Share

No... i dont know why it doesnt work i even check the max angular velocity in the phisics manager.

avatar image BrettRiet · Apr 27, 2011 at 10:06 PM 0
Share

Doesn't work still?

avatar image Clonkex · Apr 28, 2014 at 01:24 AM 0
Share

@BrettRiet If you're still having problems, try increasing the $$anonymous$$ax Angular Velocity in the project settings. For some reason, due to the way the physics engine works, it effectively limits how much torque can be applied. I would increase it 1000 and see if you code works now :)

avatar image
0

Answer by Jeff-Kesselman · Apr 28, 2014 at 01:27 AM

Check to make sure you have a RigidBody and that its IsKinematic box is not checked.

Also be sure you are applying the torque to the object with the RigidBody and not a child.

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

Answer by glenneroo · Mar 27, 2021 at 12:39 AM

(For future readers who happen on this thread via search like myself)

I had a similar issue and I solved it by adding Torque on the frame after adding force:

 Rigidbody.AddForce(targetPlayer * LaunchSpeed, ForceMode.VelocityChange);
 StartCoroutine(AddTorqueCo(TransformRef.right * this.SpinSpeed));
 
 private IEnumerator AddTorqueCo(Vector3 torque) {
     yield return null;
     Rigidbody.AddTorque(torque, ForceMode.Force);
 }
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

Script doesn't affect rigidbody's values. 0 Answers

Flight code not reading throttle axis 1 Answer

Input for Character Movement 2 Answers

How to successfully apply force calling a function from another script 1 Answer

Adding force in relation to the camera issues 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