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
0
Question by phygitalmadhouse · Mar 18, 2018 at 05:45 PM · rotationrotate objectrotatearoundquaternions

Quaternion reset rotations didnt smooth

Hi mates,

Im really "obsessed"with a reset rotation smothly in a object.

It looks like only reset his position during a frame-frame time.(?????)

Is a 3d object who manages a flying carpet and i want to capture the flying carpet rotation and reset when a oncollisionexit function when the hand of the kinect stops collision. (is for a kinect personal/hoby proyect i work in GameIndustry but as a 3D Artist).

A guy help me a lot but im stuck anyays in this simple coding lines but im not able to understand.

Any help will be appreciate. I can send a Video if needed.

 using UnityEngine;
  
  public class RotateOnCollision : MonoBehaviour {
      //Object to rotate (player)
      public Transform objectToRotate;
      public float rotationInty;
      public float smooth;
      public float speed;
  
      Vector3 objectsOriginalPosition;
      Quaternion objectsOriginalRotation;
  
      void Start()
      {
          objectsOriginalRotation = objectToRotate.transform.rotation;
      }
  
      void RecoverPosition()
      {
          Debug.Log("void recover");
          objectToRotate.transform.rotation = Quaternion.Slerp(objectToRotate.rotation, objectsOriginalRotation, Time.deltaTime * speed);
          Debug.Log("void recover end");
      }
  
      void OnCollisionStay(Collision col)
      {
          if (col.gameObject.name == "24_Thumb_Right")
          {
              //rotate y axis
              objectToRotate.transform.RotateAround(objectToRotate.transform.position, transform.up, -rotationInty);
  
              //rotate z axis
              objectToRotate.transform.Rotate(Vector3.forward * Time.deltaTime * smooth);
          }
      }
  
      void OnCollisionExit(Collision col)
      {
          if (col.gameObject.name == "24_Thumb_Right")
          {
              print("No longer in contact with " + col.transform.name);
              RecoverPosition();
          }
      }
  }
Comment
Add comment · Show 1
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 KittenSnipes · Mar 19, 2018 at 04:06 AM 0
Share

@phygitalmadhouse

A video would be lovely. I am a bit confused how you want it to work out. So any reference on what object you want this to happen to and what you want to happen would be great

0 Replies

· Add your reply
  • Sort: 

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

106 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

Related Questions

Quaternion, eulerAngles, localEulerAngles Driving me mad 1 Answer

Rotating an object in relation to its endpoints 1 Answer

How Do I add rotations to one of my objects in my AR application? 1 Answer

Rotating 2D sprite to match surface. 0 Answers

rotate object around another object 1:1 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