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 yotingo · Aug 25, 2018 at 12:23 PM · rotationvector3

How do you perform multiple rotations on the same object? - (in a single frame)

Hi,

I'm trying to perform the two following rotations on a single object without them conflicting:


  • The player will rotate the character on the local Y axis using the camera. Allowing the player to run forward in the direction of the camera. (The camera is a child of the character)

  • The artificial gravity will rotate the character to so that it's head points outward, from the center of the planet. The Y rotation is often changed to accomplish this.


I can easily do either rotation but as soon as I try to perform both, everything fails horrendously.

Vector math and Quaternions have always given me a lot of trouble conceptually. Anyone willing to teach would be greatly appreciated!


Edit: I'm trying to combine this:

 var targetCharacterOrientation = Quaternion.FromToRotation(characterBody.transform.up, upDirection) * characterBody.transform.rotation;

With this:

 var yRotation = Quaternion.AngleAxis(_mouseAbsolute.x, targetCharacterOrientation * Vector3.up); 
 characterBody.transform.rotation = yRotation * targetCharacterOrientation;

The first rotation is changing the Y rotation value and so is the second (yRotation). I need to use X and Z from the first rotation but Y from the second. I tried using Euler angles but ran into Gimbal lock.

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 eses · Aug 25, 2018 at 12:35 PM 0
Share

Hi @yotingo

I'm not sure what you mean by $$anonymous$$ching - You didn't show any code of yours. It might just be that you've done something incorrectly. What you describe should be doable.

The question is also bit vague; You seem to have some sort of $$anonymous$$i-planet perhaps? But you fail to show image or explain your reason for changing gravity direction.

Also, you probably are not doing this "player will rotate the character on the local Y axis using the camera" - as you mention that camera is child of player?

avatar image yotingo eses · Sep 06, 2018 at 04:58 AM 0
Share

Thatnks for the reply! I've updated my question with more details.

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

135 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

Related Questions

Player not facing the mouse correctly 1 Answer

Rotating wrong 0 Answers

Using xbox controller with top down shooter 0 Answers

Bullet flies away for no apparent reason. 1 Answer

Help with hold x,y,z rotation 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