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 /
avatar image
0
Question by zeuo · Dec 26, 2010 at 10:44 PM · cameraplayerlookat

how to make player looks at mouse

i want to make my player look at the mouse. but i only want it to move in the x axis. can anyone help

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 Jesse Anders · Dec 27, 2010 at 01:24 AM 1
Share

Can you edit your post and provide some more detail? Specifically, what it means for the object to 'look at' the mouse, and also what you mean by only moving 'in the x axis'. (It might help if you could point us to a game that uses the type of control scheme you have in $$anonymous$$d.)

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Jesus_Freak · Dec 26, 2010 at 10:50 PM

transform.localEulerAngles.y=Input.mousePosition.x;

Try that out.

Comment
Add comment · Show 7 · 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 Jesse Anders · Dec 27, 2010 at 01:23 AM 0
Share

Have you actually tried that? It seems very unlikely that that would cause an object to look/aim at the current mouse position.

avatar image Jesus_Freak · Dec 27, 2010 at 01:34 AM 0
Share

Yes, actually, I'm using that and more code to rotate a GUI based on mouse position and camera rotation.

avatar image Jesus_Freak · Dec 27, 2010 at 01:36 AM 0
Share

Well it rotates based on where the mouse is in camera x axis.

avatar image Jesse Anders · Dec 27, 2010 at 04:57 AM 0
Share

But does it look/aim at the mouse position? (Rotating based on the mouse's x coordinate is very different from 'looking at' the mouse position.)

avatar image Jesus_Freak · Dec 27, 2010 at 03:17 PM 0
Share

Right, sorry this acts like a homemade mouseLook script, Or at least half of it.

Show more comments

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

No one has followed this question yet.

Related Questions

How Make Camera Look at Player axis X and Z 0 Answers

Player rotates with camera(face same direction as the camera) 1 Answer

Trying to have object spin within player and always face "up" relative to camera [example pics of what I'm trying to achieve in post]] 0 Answers

My Camera lookAt script doesn't work 0 Answers

I can't look up and down because of animation on camera? 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