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 Christian.Tucker · Oct 14, 2014 at 03:26 PM · c#camerarotationcharactercontrollermouse

Third person camera; player rotation.

So, I'm trying to make something simular to what you would see in any type of action combat game, I've actually gotten pretty far in my development, but my camera has always been.... well... less than functional.

I have a cross-hair on the center of my screen, and basically what I want it to do is to have the player follow the mouse around, by rotation. The problem with this is that the only way I understand how to do it is to have the player rotate towards the mouse...

This works, but the problem is the player will never stop rotating, the reason for this is because the mouse stays in the same spot, and the player endlessly tries to play a game of catch.

Here's a video of the type of "Mouse follow" functionality I'm trying to achieve.

https://www.youtube.com/watch?v=KRsIxJKumUg

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by mwbranna · Oct 14, 2014 at 07:56 PM

If the camera is a child of the player, then the player should never try to turn toward the camera.

If the player turns, it will also move the camera so the angle between their forward vectors doesn't actually change - you will just spin.

The default mouse orbit script is intended to be put on a camera that is not a child of the object it is looking at. The script just modifies the cameras location based on your character's location to get the same effect as parenting but keeping the rotations independent.

The overall setup I'd do (may not be the best implementation but it would work) to achieve the setup in the video above would be:

  • independent (not child of player) camera with MouseOrbit script

  • player's rotation copies camera's rotation (with y direction zero'd)

  • if you want the player model to turn relative to the camera, use animations but keep the actual "forward" vector for the player the same as the camera's

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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Flip over an object (smooth transition) 3 Answers

How do I make my character lean to the sides? 0 Answers

How to make Camera position Independent of its Rotation? 1 Answer

[C#]Angle of shooting equale to mouse direction 1 Answer

Camera to follow the player in the form of radius 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