Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Nov 11, 2011 at 05:47 PM by aldonaletto for the following reason:

Question already posted at http://answers.unity3d.com/questions/185346/rotate-object-to-face-mouse-cursor-for-xz-based-to.html

avatar image
0
Question by viibl · Nov 11, 2011 at 05:47 PM · rotatemouselooktopdownmouse-look

Rotate an OBJECT along Y axis to look at mouse cursor

Normally I'd avoid posting something so frequently discussed, but I've read and tried every solution proffered in the other threads and none of them have addressed the problem.

One reason, among several, is that the solutions I've seen calculate the desired rotation angle based on the camera's orientation to the mouse cursor and then rotate the camera to match. This is not desirable.

Instead, I want to rotate just the object to face the cursor, leaving the camera's orientation intact.

Conceptually, I think that I need to get the x/y screen location of the cursor, calculate the difference in angle between the cursor's position and the objects's front vector and then rotate the object along the y axis so that the front vector intersects with the cursor's position.

Caveats: I'm not a strong coder, and I've been using uScript for a lot of my work so far. Anything prescriptive that you can provide to get me over this hump is greatly appreciated, and I know a lot of other people have been wrestling with the same issue.

Comment
Add comment
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

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Trouble with controls on top down fixed camera game. 1 Answer

how to get mouselook that the mouse X and mouse Y wasn't depend on X and Y axis when i got to rotated in Z axis? 0 Answers

Can't use camera.main [SOLVED] 1 Answer

RayCasting shows wrong point 1 Answer

Trouble with FPControler Mouse Look Script 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