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 /
  • Help Room /
avatar image
0
Question by KeithSeraph · Aug 23, 2016 at 07:42 AM · rotationtransformvector3quaternion

Quaternion rotation issue please help :'(

I wanted to have my characters spine rotate to the right everytime he aimed, but it is not working. I am pretty sure it is the script because I am not very good with Vector3 and Quaternions. There were no errors in the console after I saved the script either. HipPose is basically when he is not aiming and AimPose is when he is aiming and the spine is rotated to that position.

 var HipPose : Quaternion;
 var AimPose : Quaternion;
 
 
 
 function Start () {
     transform.localRotation = HipPose;
 }
 
 function Update () {
     if(Input.GetButton("Fire2")){
         transform.localRotation = AimPose;
     }
     
     if(!Input.GetButton("Fire2")){
         transform.localRotation = HipPose;
     }
 }
Comment
Add comment · Show 3
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 tanoshimi · Aug 23, 2016 at 08:08 AM 1
Share

To what object is this script attached? Do you have an animator component (in which case, that will likely overwrite whatever rotations you're setting)

avatar image KeithSeraph tanoshimi · Aug 26, 2016 at 07:05 PM 0
Share

the script is attached to the spine of my character, the character is rigged w/ animations and has an animator component. Is that the issue?

avatar image ScaniX · Aug 23, 2016 at 08:52 AM 0
Share

The first things to make sure of is: if and when those lines are executed. Just add a Debug.Log() call inside of both ifs to see what is happening.

Also you can print out the angles of thise rotations (Debug.Log(AimPose.Euler)) and compare it with the values you want to set from the inspector.

You can also add these lines to the first if to pause the game in the editor, so you can check the current values in the inspector:

 if (Input.GetButton("Fire2")) {    
     transform.localRotation = AimPose;
 #if UNITY_EDITOR
     UnityEditor.EditorApplication.isPaused = true;
 #endif
 }

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to use Quaternion.Slerp with transform.LookAt? 3 Answers

Why isn't my steering wheel working? 0 Answers

how to convert a Vector3 to a float value? 1 Answer

Rotation Perpendicular to Line Segment 1 Answer

Quaternion Rotation - AngleAxis/EulerAngle 2 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