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 /
avatar image
1
Question by $$anonymous$$ · May 11, 2017 at 02:17 PM · rotationphysicsrigidbodybug-perhapstorque

Freeze Rotation constraints doesn't work.

Hi! After i locked the rotation constraints i still can add rotation with rigidbody.AddTorque. (If i lock position constraints, then i cant use AddForce on the object.) And if the rigidbody collide with other object under the effect of addtorque , then it will ignore all rotation constraint. here the example video:

https://youtu.be/emGu-IgU7YQ (in the video i have not locked the y axis. btw no difference)

sry for my english and ty for any advice

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 SohailBukhari · May 12, 2017 at 12:09 PM 0
Share

try freezing rotation manually

 void LateUpdate()
  {
      transform.localEulerAngles = new Vector3(0, 0, transform.localEulerAngles.z);
  }



avatar image $$anonymous$$ SohailBukhari · May 12, 2017 at 12:46 PM 0
Share

yes, it is a really easy hack, but not a good solution for me. btw i already do it in fixedUpdate, before the physics simulation.

2 Replies

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

Answer by $$anonymous$$ · May 18, 2017 at 11:05 AM

Okey i found the solution. If the rigidbody have a child collider then it recalculates the inertiaTensorRotation. I have to manually set the inertiaTensoreRotation (at my case its quaternion.identity)

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 HesamJafarian · Apr 16, 2021 at 01:52 PM 0
Share

Hi, I have been adding the following codes however as I perform an operation after a certain number of iterations the geometries lose the fixed position and orientation. Did you do this in update function or fixedUpdate function>

rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.transform.localPosition = Vector3.zero; rb.centerOfMass = Vector3.zero; rb.inertiaTensorRotation = Quaternion.identity;

avatar image
1

Answer by Weetman · May 12, 2017 at 12:15 PM

From Rigidbody.constraints:

Note that position constraints are applied in World space, and rotation constraints are applied in Local space.

I could not find any reference as to which coordinate systems the Rigidbody.AddTorque uses, however in Rigidbody.AddRelativeTorque:

Adds a torque to the rigidbody relative to its coordinate system.

Therefore I presume AddTorque should add a torque in World space system, and the rotation constrains are applied in Local space. Perhaps you could try using Rigidbody.AddRelativeTorque instead.

I hope it helped!

EDIT: Actually, from AddTorque:

torque: Torque vector in world coordinates.

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 $$anonymous$$ · May 12, 2017 at 12:56 PM 0
Share

Thank you for your answer, but it's not relevant. Check the youtube video. it doesn't matter if the torque axis is in World or Local coordinate because the y axis should be the same.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Without affecting Velocity, what is the best method to apply direction to an object moving with forces? 1 Answer

add force to rotation 1 Answer

Is there any way to keep increasing an object's angular velocity? 1 Answer

Returning a rigidbody back to its original x and z rotations through physics forces. 2 Answers

Rigidbody rotation with PID controller and torque 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