Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 Trild123787898 · Mar 21, 2019 at 05:30 PM · transformscript.jointslocalrotation

LocalRotation does not work

why LocalRotation does not want to work in this line  gmo.transform.localRotation = Quaternion.identity;

here is the script

 void Start()
      {
          rb = GetComponent<Rigidbody>();
      }
      void OnTriggerStay(Collider other)
      {
          if (other.CompareTag("Player"))
          {
            
             
                 invite = true;
                 rb.isKinematic = true;
                 rb.detectCollisions = true;
                 if (timeCount >= 2.0f)
                 {
                     
                     rb.isKinematic = false;
                     rb.detectCollisions = false;
                     transform.SetParent(other.transform, true);
 
                 gmo.transform.localRotation = Quaternion.identity;
 
                 BlazeIt = gameObject.GetComponent<HingeJoint>();
                     BlazeIt.connectedBody = targetJoint;
 
                     Debug.Log("Good");
                 }
                 timeCount = timeCount + Time.deltaTime;
 
             
 
 
          }
      }
 
     void Update()
     {
 
 
         if (invite == true)
         {
             if (Input.GetKey(KeyCode.T))
             {
                 transform.position = Vector3.Lerp(startMarker.position, targetTransform.position, timeCount);
                 gmo.transform.localRotation = Quaternion.identity;
                 // transform.DORotate(pos, duration, RotateMode.Fast);
             }
         }
         
 
        
 
     }
 
 }
 
Comment
Add comment · Show 4
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 Hellium · Mar 21, 2019 at 05:59 PM 0
Share

You will have to explain what makes you say "it does not work". The local rotation is the rotation in the local space of the parent gameObject. So after calling gmo.transform.localRotation = Quaternion.identity;, gmo will be aligned with its parent.

avatar image Trild123787898 Hellium · Mar 21, 2019 at 07:26 PM 0
Share

There are two objects A and B. To become a child of And with SetParent and then LocalRotation should have worked

avatar image mchts · Mar 21, 2019 at 07:36 PM 0
Share

What is gmo and is there any script attached to it?

avatar image Trild123787898 mchts · Mar 21, 2019 at 07:55 PM 0
Share

gmo is the one whose object you want to use LocalRotation for sure

 public GameObject gmo;

1 Reply

· Add your reply
  • Sort: 
avatar image
-1

Answer by cs120319992 · Mar 21, 2019 at 05:44 PM

*gmo.transform.rotation = Quaternion.identity;

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 Hellium · Mar 21, 2019 at 05:58 PM 0
Share

localRotation and rotation are different. The first one means the rotation in the local space of the parent object while the 2nd one means the rotation in the world space.

avatar image Trild123787898 · Mar 22, 2019 at 10:02 AM 0
Share

I do not think that this is the way out

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

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

The position of the object and its changes! Help me can not understand! 0 Answers

How to fix the problem with joint! HELP I CAN NOT UNDERSTAND! 0 Answers

Help with tractor technology 0 Answers

does not want to work MoveTowards 1 Answer

attaching the hingeJoint to the desired point 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