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 Yugen · Feb 28, 2013 at 04:48 AM · c#cameracontrols

WASD Movement with Mouse position dictating which way the character is facing

How would I go about doing this? I have basic WASD Movement, a locked top down/almost isometric camera (though the camera is not following the character). I just cannot for the life of me figure out how to get my character to turn whichever direction the mouse is facing.

I've been using C# so far, though admittedly have no idea what the hell im doing. Been learning the hard way, whenever I don't know what something is I look it up and so far have got a title screen working and now am stuck on character controls.

Will try to help answer any questions you may have, still pretty new at unity. This is my first real project.

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 robertbu · Feb 28, 2013 at 07:02 AM 0
Share

@liamcary 's answer is probably what you are looking for, but I quite visualize your problem. In particular I cannot figure out how the WASD key movement interacts with the mouse "position." I assume when you say "turn whichever direction the mouse is facing," you are talking about projecting the mouse position down to character eye level. Oh, and is the plane even or some sort of terrain?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by liamcary · Feb 28, 2013 at 05:21 AM

Are you aiming for something like Beat Hazard but in an isometric world? You could do that by raycasting into the screen from the mouse position and setting the player's transform.LookAt() to be the position where the raycast collides with the ground.

I'd recommend you look at using Camera.ScreenPointToray, a Layer Mask to ensure the raycast hits the ground, and Transform.LookAt to actually set the player to look towards the point that the raycast hit.

Comment
Add comment · Show 1 · 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 Yugen · Mar 01, 2013 at 01:13 AM 0
Share

Thanks should give me a place to start looking :)

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

10 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

Related Questions

I need help with TPS controls! 0 Answers

Distribute terrain in zones 3 Answers

Issue with my camera controls 0 Answers

Pinch Zoom and Pan while not calling other functions 1 Answer

Change controls based on camera orientation.,How do I change my controls based on camera orientation. 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